lukechilds / docker-electrumx

Run an Electrum server with one command
MIT License
109 stars 124 forks source link

docker-electrumx immediately drops incoming RPC connections from Electrum #50

Open schildbach opened 4 years ago

schildbach commented 4 years ago

I'm running Electrum 3.2.4 (also tried 3.3.8) on a fully up to date Ubuntu 18.04 using this command:

electrum/electrum gui -v --oneserver --server <myhost>:50002:s

I'm getting this output in the console, the connection is immediately dropped and my wallets are not updated:

[Network] connecting to <myhost>:50002:s as new interface
[myhost] connected
[Network] switching to <myhost>:50002:s
[Network] sending subscriptions to <myhost>:50002:s 26 0
[myhost] connection closed remotely
[profiler] Standard_Wallet.get_full_history 0.0007
[profiler] HistoryList.on_update 0.0011

In electrumx-docker, I only see

electrumx_1  | INFO:ElectrumX:[23] SSL <myip>:34316, 0 total

sometimes (but not always) followed by

electrumx_1  | INFO:ElectrumX:[5] changing task concurrency from 10 to 6
electrumx_1  | INFO:ElectrumX:[5] disconnected whilst throttled

I can

$ telnet <myhost> 50002
Trying <myip>...
Connected to <myhost>.
Escape character is '^]'.

or

$ openssl s_client -connect <myhost>:50002
CONNECTED(00000005)
depth=0 O = ElectrumX
verify error:num=18:self signed certificate
verify return:1
depth=0 O = ElectrumX
verify return:1
[...]

and is stays connected for a while.

Both bitcoind and electrumx are fully synched, earlier in the log I see

electrumx_1  | INFO:SessionManager:SSL server listening on electrumx:50002

My host is a fully up to date Ubuntu Server 18.04. This is my docker-electrumx config:

$ cat docker-compose.yaml 
version: "3"
services:
  bitcoind:
    image: nicolasdorier/docker-bitcoin:0.18.1
    volumes:
      - "<mybitcoinddata>:/data"
    ports:
      - "<myip>:8333:8333"
    environment:
      BITCOIN_EXTRA_ARGS: |
        txindex=1
        disablewallet=1
        rpcuser=electrumx
        rpcpassword=<mypassword>
        [main]
        rpcbind=bitcoind
  electrumx:
    image: lukechilds/electrumx:v1.13.0
    volumes:
      - "<myelectrumxdata>:/data"
    ports:
      - "<myip>:50002:50002"
    environment:
      - DAEMON_URL=http://electrumx:<mypassword>@bitcoind
      - COIN=BitcoinSegwit
      - SERVICES=ssl://electrumx:50002
      - LOG_LEVEL=debug

I tried the same with testnet; same results.

(<myip>, <myhost>, <mypassword>, <mybitcoinddata> and <myelectrumxdata> obviously have real values in the real config)

schildbach commented 4 years ago

To exclude any SSL-related problem, I configured a (non-SSL) TCP connection between ElectrumX and Electrum – the problem persists.

To exclude any limiting issues, I tried adding

      - COST_SOFT_LIMIT=0
      - COST_HARD_LIMIT=0

but the problem persists.

lukechilds commented 4 years ago

Can you get a response from ElectrumX over telnet?

Once you get a connection try pasting:

{"id": 1, "method": "server.version", "params": []}

And see if you get a response.

e.g:

lukechilds@bitcoin:~$ telnet localhost 50001
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
{"id": 1, "method": "server.version", "params": []}
{"jsonrpc": "2.0", "result": ["ElectrumX 1.13.0", "1.4"], "id": 1}
1n5aN1aC commented 4 years ago

I have what appears to be the same symptoms. for me, this began happening after I switched my image from v1.12 to v1.15

Both Electrum V3.3.8 & 4.0.2 Tested.

Here is what I get spammed in my ElectrumX console:

INFO:ElectrumX:[26] SSL 10.0.0.116:54339, 0 total
INFO:ElectrumX:[27] SSL 10.0.0.116:54344, 0 total
INFO:ElectrumX:[28] SSL 10.0.0.116:54349, 0 total
INFO:ElectrumX:[29] SSL 10.0.0.116:54354, 0 total
INFO:ElectrumX:[30] SSL 10.0.0.116:54361, 0 total
1n5aN1aC commented 4 years ago

I connected over telnet to TCP, and do get a response, but it complains about formatting:

{"id": 1, "method": "server.version", "params": []} Responds with: {"jsonrpc": "2.0", "error": {"code": -32700, "message": "messages must be encoded in UTF-8"}, "id": null}

And just hitting enter returns: {"jsonrpc": "2.0", "error": {"code": -32700, "message": "invalid JSON"}, "id": null}

mariobyn commented 4 years ago

Any updates on this issue?

1n5aN1aC commented 4 years ago

@mariobyn I tried many things, and had no success.

What did bring success was blowing away all data relating to the image, and having it re-process the entire blockchain.

mariobyn commented 4 years ago

@1n5aN1aC i tried your thing and it still didn't work after a while it started again, I looked on the RPC client with more verbose logs and it seems it was an issue on my part due to resources so I set COST_SOFT_LIMIT=0 COST_HARD_LIMIT=0

and it worked...

1n5aN1aC commented 9 months ago

I had this happen again, and the only solution I could find was to blow away all my electrum data and have it rebuild it all from scratch again. Very strange.