namecoin / electrum-nmc

Namecoin port of Electrum Bitcoin client.
https://www.namecoin.org/
MIT License
29 stars 24 forks source link

CancelledError when switching servers in Network dialog while syncing #232

Open JeremyRand opened 4 years ago

JeremyRand commented 4 years ago

@gits7r reported an error on Matrix/IRC:

Traceback (most recent call last):
File "electrum_nmc\electrum\gui\qt\network_dialog.py", line 90, in
File "electrum_nmc\electrum\gui\qt\network_dialog.py", line 440, in follow_server
File "electrum_nmc\electrum\network.py", line 317, in run_from_another_thread
File "concurrent\futures\_base.py", line 430, in result
concurrent.futures._base.CancelledError

Reportedly this happens in 3.3.9.1 if you change the server in the Qt Network dialog while the chain is still syncing.

JeremyRand commented 4 years ago

@gits7r Were you changing the server by choosing a different entry in the server list, or by editing the server/port text boxes?

JeremyRand commented 4 years ago

@gits7r Which Python version were you testing with? The fact that this is related to a CancelledError makes me wonder if this is an instance of https://github.com/spesmilo/electrum/issues/5798 (which only impacts Python 3.8+).

JeremyRand commented 4 years ago

Having no luck reproducing this on Whonix 15, even if I deliberately disconnect the network connection while syncing.

gits7r commented 4 years ago

I tried by switching to a server in the list with right-click "use server".

The vm i was trying this one uses Python 3.7.3. However, on 3.3.10 latest I also don't seam to be able to reproduce. You don't need to disconnect the network connection of the vm to trigger it, you just need to switch to a different server in the list by going to Electrum-NMC GUI -> Network -> right-click on a different server and click use as server while the wallet is still syncing (twisted arrow displaying on the right bottom corner instead of green / blue light).

Try one more time with the steps I described (delete blockchain_headers file before) and if you still can't reproduce it means we fixed it somewhere between 3.3.8-3.3.9 and 3.3.10 and we can close this -- we will reopen if I ever catch it.

JeremyRand commented 4 years ago

@gits7r When you encountered this, did you have a SOCKS proxy enabled in Electrum-NMC? Wondering if maybe the bug is dependent on that.

gits7r commented 4 years ago

I don't recall exactly, 99% I did not had SOCKS proxy enabled because my Electrum-NMC testing vm comes with native IPv6 and direct public IP assigned to it both IPv4 and IPv6.

I tried now again with SOCKS proxy enabled and I was able to reproduce. I deleted blockchai_headers file, started Electrum-NMC and while syncing right clicked on a different server in the list and selected "use as server".

First the GUI hangs appearing as 'not responding' and after few seconds the bug pop-up and traceback appears:

Traceback (most recent call last): File "electrum_nmc\electrum\gui\qt\network_dialog.py", line 90, in File "electrum_nmc\electrum\gui\qt\network_dialog.py", line 440, in follow_server File "electrum_nmc\electrum\network.py", line 317, in run_from_another_thread File "concurrent\futures_base.py", line 430, in result concurrent.futures._base.CancelledError

Also, see the attached image. the servers are at height 506461. Our current height is 499475, but the network light is green as 'fully synced' and the transactions appear as 'not verified'.

After seconds (more or less, depending on server, connection etc.) it eventually catches up, and all appear good. But shouldn't we display the twisted arrow as 'syncing' while not caught up to current height?

1

Also, when I am connected via a SOCKS proxy I am connected to like 11 servers. Without any SOCKS proxy it connects to about 4 -- is this normal and expected?