Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Operation timed out #2475

Open
1 task done
DanielAtCosmicDNA opened this issue Dec 7, 2024 · 3 comments
Open
1 task done

[Bug]: Operation timed out #2475

DanielAtCosmicDNA opened this issue Dec 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@DanielAtCosmicDNA
Copy link
Contributor

What did you expect to happen?

I run a local atuin server within my Debian distro on a new and free tier database. I was expecting no error whatsoever when performing atuin sync. As the operation was timing out over and over again I developed a persistent script as follows:

#!/bin/sh

# Maximum number of attempts
max_attempts=50
# Initial attempt counter
attempt_num=1

# Loop until the command is successful or the maximum number of attempts is reached
while [ $attempt_num -le $max_attempts ]; do
    # Run the command
    atuin sync

    # Check the exit code of the command
    if [ $? -eq 0 ]; then
        echo "Command succeeded on attempt $attempt_num"
        break
    else
        echo "Attempt $attempt_num failed. Retrying..."
        attempt_num=$((attempt_num + 1))
        # Optional: wait for a few seconds before retrying
        sleep 5
    fi
done

# Check if the command was successful after all attempts
if [ $attempt_num -gt $max_attempts ]; then
    echo "Command failed after $max_attempts attempts."
fi

What happened?

The script output shows that eventually the database was synced after many retrials:

Error: error sending request for url (http://localhost:8888/history): operation timed out

Caused by:
    operation timed out

Location:
    /home/runner/work/atuin/atuin/crates/atuin-client/src/api_client.rs:267:20
Attempt 1 failed. Retrying...
Error: error sending request for url (http://localhost:8888/history): operation timed out

Caused by:
    operation timed out

Location:
    /home/runner/work/atuin/atuin/crates/atuin-client/src/api_client.rs:267:20
Attempt 2 failed. Retrying...
Error: error sending request for url (http://localhost:8888/history): operation timed out

Caused by:
    operation timed out

Location:
    /home/runner/work/atuin/atuin/crates/atuin-client/src/api_client.rs:267:20
Attempt 3 failed. Retrying...
Error: error sending request for url (http://localhost:8888/history): operation timed out

Caused by:
    operation timed out

Location:
    /home/runner/work/atuin/atuin/crates/atuin-client/src/api_client.rs:267:20
Attempt 4 failed. Retrying...
Sync complete! 114107 items in history database, force: false
Command succeeded on attempt 5

Atuin doctor output

{
  "atuin": {
    "version": "18.3.0",
    "sync": {
      "cloud": false,
      "records": false,
      "auto_sync": true,
      "last_sync": "2024-12-07 21:44:26.760521329 +00:00:00"
    },
    "sqlite_version": "3.44.0"
  },
  "shell": {
    "name": "zsh",
    "default": "zsh",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Debian GNU/Linux",
    "arch": "x86_64",
    "version": "12",
    "disks": [
      {
        "name": "none",
        "filesystem": "overlay"
      },
      {
        "name": "drivers",
        "filesystem": "9p"
      },
      {
        "name": "/dev/sdc",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/sdc",
        "filesystem": "ext4"
      },
      {
        "name": "none",
        "filesystem": "overlay"
      },
      {
        "name": "none",
        "filesystem": "overlay"
      },
      {
        "name": "none",
        "filesystem": "overlay"
      },
      {
        "name": "C:\\134",
        "filesystem": "9p"
      },
      {
        "name": "D:\\134",
        "filesystem": "9p"
      },
      {
        "name": "E:\\134",
        "filesystem": "9p"
      },
      {
        "name": "/dev/sdc",
        "filesystem": "ext4"
      }
    ]
  }
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@DanielAtCosmicDNA DanielAtCosmicDNA added the bug Something isn't working label Dec 7, 2024
@mateuscomh
Copy link
Contributor

mateuscomh commented Dec 10, 2024

I would initiate a debug targeting your connectivity to your localhost. Could you share the result of a port and connection test with your DB?

pg_isready -h localhost -p 5432 -U your_user
sudo systemctl status atuin
ps aux | grep atuin
ss -tunlp | grep 8888

@ellie
Copy link
Member

ellie commented Dec 10, 2024

new and free tier database.

We actually make quite heavy usage of postgres, so this is unlikely to cut it. You'll also want to put

[sync]
records = true

In your client config.

@DanielAtCosmicDNA
Copy link
Contributor Author

I can not interact with the instance as I completely uninstalled it due to Debian kernel errors within WSL2. It may be so that was affecting the systemd managed atuin server in spurious ways.

Here are the things I backed up yesteday:

atuin-server.service

[Unit]
# User=dynuser
Description=Atuin Server
# DynamicUser=1

[Service]
Type=simple
ExecStart=/usr/bin/atuin-server.sh
Environment="HOME=/home/daniel/"
Environment="RUST_BACKTRACE=1"

[Install]
WantedBy=multi-user.target

server.toml

## host to bind, can also be passed via CLI args
# host = "127.0.0.1"

## port to bind, can also be passed via CLI args
# port = 8888

## whether to allow anyone to register an account
# open_registration = false

## URI for postgres (using development creds here)
# db_uri="postgres://username:password@localhost/atuin"

## Maximum size for one history entry
# max_history_length = 8192

## Maximum size for one record entry
## 1024 * 1024 * 1024
# max_record_size = 1073741824

## Webhook to be called when user registers on the servers
# register_webhook_username = ""

## Default page size for requests
# page_size = 1100
host = "127.0.0.1"
port = 8888
open_registration = true
db_uri="<redacted>"

where atuin-server.sh was simply:

#!/bin/sh
atuin server start

To my surprise, when I ran today in a new Debian instance within WSL2, and with the server invoked from the command line as opposed to being invoked as a service, it seems to have worked as I would expect. The only drawback is that the database seems to have been cleared for any reason I do not know.

Here is the output:

Uploading 18 records to 0193b011957f7880a8b1efdbb89e019c/history
  [00:00:00] [#################################################################################################################################################] 18/18 (0.0s)19/0 up/down to record store
Sync complete! 427 items in history database, force: false

I backed zsh_history, but I am not sure if atuin allows me to upload this info into the database...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants