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: electrs p2p disconnects on "Broken pipe (os error 32)" and exits #1011

Open
iyusaf opened this issue Feb 28, 2024 · 2 comments
Open

Bug: electrs p2p disconnects on "Broken pipe (os error 32)" and exits #1011

iyusaf opened this issue Feb 28, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@iyusaf
Copy link

iyusaf commented Feb 28, 2024

Describe the bug
electrs fails on p2p disconnects running against Satoshi:26.0.0 on Debian bullseye with "Broken pipe (os error 32)".

Electrs version
electrs v0.10.3

To Reproduce
Steps to reproduce the behavior:

  1. Configure and start electrs
  2. Connect with Sparrow wallet via SSH tunnel
  3. Explore wallet addresses
  4. See error

Expected behavior
electrs should not exit.

Configuration

electrs.service
[Unit]
Description=Electrs
After=bitcoind.service

[Service]
WorkingDirectory=/home/bitcoin/.electrs
ExecStart=/usr/local/bin/electrs --log-filters WARN --db-dir ./db --electrum-rpc-addr="127.0.0.1:50001"
User=bitcoin
Group=bitcoin
Type=simple
KillMode=process
TimeoutSec=60
Restart=always
RestartSec=60

Environment="RUST_BACKTRACE=1"

# Hardening measures
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target
electrs error log
Feb 28 07:01:35 zeus systemd[1]: Started Electrs.
Feb 28 07:01:35 zeus electrs[3058]: Starting electrs 0.10.3 on x86_64 linux with Config { network: Bitcoin, db_path: "./db/bitcoin", db_log_dir: None, daemon_dir: "/home/bitcoin/.bitcoin", daemon_auth: CookieFile("/home/bitcoin/.bitcoin/.cookie"), daemon_rpc_addr: 127.0.0.1:8332, daemon_p2p_addr: 127.0.0.1:8333, electrum_rpc_addr: 127.0.0.1:50001, monitoring_addr: 127.0.0.1:4224, wait_duration: 10s, jsonrpc_timeout: 15s, index_batch_size: 10, index_lookup_limit: None, reindex_last_blocks: 0, auto_reindex: true, ignore_mempool: false, sync_once: false, skip_block_download_wait: false, disable_electrum_rpc: false, server_banner: "Welcome to electrs 0.10.3 (Electrum Rust Server)!", signet_magic: f9beb4d9, args: [] }
Feb 28 07:04:35 zeus electrs[3058]: [2024-02-28T12:04:35.317Z WARN  electrs::thread] p2p_send thread failed: p2p failed to send
Feb 28 07:04:35 zeus electrs[3058]: [2024-02-28T12:04:35.317Z WARN  electrs::thread] because: Broken pipe (os error 32)
Feb 28 07:04:35 zeus electrs[3058]: [2024-02-28T12:04:35.317Z WARN  electrs::electrum] RPC blockchain.scripthash.get_history failed: failed to get block 000000000000000000083b1f4b5bdc0a589f7637ad6de6f578ddbb1cbe21bc92: receiving on an empty and disconnected channel
Feb 28 07:04:35 zeus electrs[3058]: Error: electrs failed
Feb 28 07:04:35 zeus electrs[3058]: Caused by:
Feb 28 07:04:35 zeus electrs[3058]:     0: sync failed
Feb 28 07:04:35 zeus electrs[3058]:     1: sending on a disconnected channel
Feb 28 07:04:35 zeus systemd[1]: electrs.service: Main process exited, code=exited, status=1/FAILURE
Feb 28 07:04:35 zeus systemd[1]: electrs.service: Failed with result 'exit-code'.
Feb 28 07:04:35 zeus systemd[1]: electrs.service: Consumed 20.130s CPU time.
bitcoin.conf
rpcauth=XXX

[main]
rpcbind=127.0.0.1
rpcbind=X.X.X.X
rpcallowip=127.0.0.1
rpcallowip=X.X.X.0/24

## Whitelisting is intended for 'electrs'
[email protected]
[email protected]

Environment variables: N/A
Arguments: see above

System running electrs

  • Compiled natively
  • 5.10.0-28-amd64 No. 1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 GNU/Linux

Electrum client
Sparrow on macOS Sonoma 14.2.1

Additional context
Sparrow is connecting via SSH tunnel.
Trace file is attached. Apologies for the large file.
problem.log

Many thanks for your help. Cheers!

@iyusaf iyusaf added the bug Something isn't working label Feb 28, 2024
@romanz romanz self-assigned this Feb 28, 2024
@su-sd
Copy link

su-sd commented Aug 11, 2024

The same happened on my end with a direct connection on the same server.
I have a script which analyzes a lot of transactions and balances. If the electrs server crashes after several days, it is quite annoying.

[2024-08-11T03:45:38.331Z DEBUG electrs::server] 16: recv [{"method": "blockchain.scripthash.get_history", "params": ["03308ec8dd9f3324db5fef4e83a268abcabbafd247ae53e7bcfec51002c236e9"], "id": 39398, "jsonrpc": "2.0"}]
[2024-08-11T03:45:38.331Z INFO  electrs::electrum] your wallet uses less efficient method of querying electrs, consider contacting the developer of your wallet. Reason: blockchain.scripthash.get_history called for unsubscribed scripthash
[2024-08-11T03:45:40.159Z DEBUG electrs::p2p] loading 216003 blocks
[2024-08-11T03:45:40.202Z DEBUG electrs::p2p] closing p2p_loop thread: peer has disconnected
[2024-08-11T03:45:40.202Z WARN  electrs::thread] p2p_send thread failed: p2p failed to send
[2024-08-11T03:45:40.202Z WARN  electrs::thread] p2p_recv thread failed: failed to recv a message from peer: IO error
[2024-08-11T03:45:40.203Z WARN  electrs::electrum] RPC blockchain.scripthash.get_history failed: failed to get block 00000000000000000012206336bbb49aca889479cae2877399756ad5798d4ffb: receiving on an empty and disconnected channel
[2024-08-11T03:45:40.203Z DEBUG electrs::server] 16: send [{"error":{"code":1,"message":"failed to get block 00000000000000000012206336bbb49aca889479cae2877399756ad5798d4ffb"},"id":39398,"jsonrpc":"2.0"}]
[2024-08-11T03:45:40.204Z INFO  electrs::db] closing DB at ./db/bitcoin
[2024-08-11T03:45:40.203Z WARN  electrs::thread] because: Broken pipe (os error 32)
[2024-08-11T03:46:03.905Z DEBUG electrs::server] 16: disconnected
Error: electrs failed

Caused by:
    0: sync failed
    1: sending on a disconnected channel

@su-sd
Copy link

su-sd commented Aug 11, 2024

This is easy reproducible with
``blockchain.scripthash.get_history scripthash(1N52wHoVR79PMDishab2XmRHsbekCdGquK)`

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