romanz / electrs

An efficient re-implementation of Electrum Server in Rust
MIT License
1.05k stars 387 forks source link

Electrs works, but clients cannot connect to it anymore since upgrading to 24.04 LTS #1064

Closed svpi11 closed 1 month ago

svpi11 commented 1 month ago

Electrs works fine in my setup for years. I always upgrade to the latest version, so I run now the latest one.

After upgrading my server from Ubuntu Server 22.04 LTS to 24.04 LTS yesterday, I have now this result: Electrs service seems working fine, but I cannot connnect my applications from the client side to it anymore (such as electrum or mempool).

Here are the logs : juil. 24 22:46:40 serveur electrs[7646]: [2024-07-24T20:46:40.194Z INFO electrs::server] serving Electrum RPC on 127.0.0.1:50001 juil. 24 22:46:40 serveur electrs[7646]: [2024-07-24T20:46:40.268Z INFO electrs::db] "/home/electrs/.electrs/db/bitcoin": 212 SST files, 48.809674349 GB, 6.0953677 Grows juil. 24 22:46:42 serveur electrs[7646]: [2024-07-24T20:46:42.793Z INFO electrs::chain] loading 853754 headers, tip=000000000000000000022fb9dadd4cc5b3599b8ff19436fdf481519722761756 juil. 24 22:46:45 serveur electrs[7646]: [2024-07-24T20:46:45.196Z INFO electrs::chain] chain updated: tip=000000000000000000022fb9dadd4cc5b3599b8ff19436fdf481519722761756, height=853754 juil. 24 22:47:26 serveur electrs[7646]: [2024-07-24T20:47:26.339Z WARN electrs::mempool] mempool sync failed: batch getrawtransaction request failed: transport error: Couldn't connect to host: Resource temporarily unavailable (os error 11) juil. 24 22:49:48 serveur electrs[7646]: [2024-07-24T20:49:48.185Z WARN electrs::mempool] mempool sync failed: batch getrawtransaction request failed: transport error: Couldn't connect to host: Resource temporarily unavailable (os error 11) juil. 24 22:50:34 serveur electrs[7646]: [2024-07-24T20:50:34.242Z WARN electrs::mempool] mempool sync failed: batch getrawtransaction request failed: transport error: Couldn't connect to host: Resource temporarily unavailable (os error 11) juil. 24 22:50:44 serveur electrs[7646]: [2024-07-24T20:50:44.644Z INFO electrs::index] indexing 1 blocks: [853755..853755] juil. 24 22:50:44 serveur electrs[7646]: [2024-07-24T20:50:44.863Z INFO electrs::chain] chain updated: tip=00000000000000000000bcf7548fbed3419492348345484fdcfb4a910d3877a8, height=853755 juil. 24 22:51:30 serveur electrs[7646]: [2024-07-24T20:51:30.562Z WARN electrs::mempool] mempool sync failed: batch getrawtransaction request failed: transport error: Couldn't connect to host: Resource temporarily unavailable (os error 11) juil. 24 22:52:12 serveur electrs[7646]: [2024-07-24T20:52:12.397Z WARN electrs::mempool] missing mempool entry: b193a5ce76044a16558624c989c5c21d89a8ae20d893a17ea9955b682d583553

To Reproduce Upgrading to 24.04 LTS

Expected behavior Same behavior than 22.04 LTS (working perfectly)

Configuration electrs.conf: network = "bitcoin" daemon_dir= "/home/bitcoin/.bitcoin" daemon_rpc_addr = "127.0.0.1:8332" daemon_p2p_addr = "127.0.0.1:8333"

electrum_rpc_addr = "127.0.0.1:50001" db_dir = "/home/electrs/.electrs/db" index_lookup_limit = 1000

log_filters = "INFO" timestamp = true

System running electrs

Electrum client Client name (if not upstream desktop Electrum) and version: Debian 12 bookworm

It seems definitely that the problem is a connection and not something coming from electrs inside itself, (maybe issue regarding tor link with electrs ?). But the fact is I use a wireguard VPN setup to connect to electrs faster, and also use other services (such as lightning node), that works perfectly... So I have no idea where to look at.

PS: I had that bitcoin.service is working perfectly through tor.

Kixunil commented 1 month ago

This appears to not be problem with electrs and I'm not entirely sure what's the problem but from the logs it looks like bitcoind hasn't fully started yet. Try waiting until it starts and then restarting electrs.

Tip: if you're using systemd to launch your services use these options to improve reliability:

bitcoin.conf

startupnotify=systemd-notify --ready

bitcoin.service

Type=notify
NotifyAccess=all

electrs.service

[Unit]
After=bitcoind.service

If you're not, consider starting to use it or improve your start script to wait until bitcoind starts up. Note that chain syncing is not part of start up and some RPC methods will fail during IBD.

svpi11 commented 1 month ago

Thanks for your answer !

It's strange cause I do run bitcoind as a service too, and it was up and running with multiple of peers at that time. Thanks for the tips, but sadly all those line were already in my services configuration files too. I just added startupnotify line to bitcoin.conf, but it didn't change anything.

Today, I also tried to build again electrs from source using cargo, as I always did in the previous 22.04 LTS version. I had a new issue that I never had before, maybe is it related ??

Here is the log of compiling :

Compiling electrs-rocksdb v0.19.0-e3 warning: unused imports: Config, ResultExt --> /home/electrs/electrs/target/release/build/electrs-ea24af71e9178993/out/configure_me_config.rs:2:21 2 pub use super::{Config, ResultExt}; ^^^^^^ ^^^^^^^^^

= note: #[warn(unused_imports)] on by default

The problem comes when it arrives to electrs-rocksdb, (nothing before), and it freeze a longer time on the complilation of it. After doing cargo fix --lib -p electrs, the compilation ends well, but still.

Let me know if you think it may be related !

PS: I tried to let those services run like this hours, and the problem persist: I cannot connect my clients to my electrs server.

Kixunil commented 1 month ago

Oh, now that I'm looking at the log again, it's actually the OS refusing to cooperate for some reason. You can try running electrs under strace -Z (put strace -Z in front of electrs launch command).

That warning is just cosmetic and definitely doesn't cause any real problems.

svpi11 commented 1 month ago

Ok so finally after multiple tries, I found the solution...

I forgot that my elects server was behind a reverse proxy service (nginx), which has been malfunctioned and altered by the upgrade. So the electrs server was indeed working fine but couldn't communicate with the outside...

Nothing to see directly with electrs then. I will close the issue, thanks a lot for your answers and efforts