spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.39k stars 3.08k forks source link

Electrum window dissapear completely on Linux while running in the background #6404

Closed github12101 closed 3 years ago

github12101 commented 4 years ago

Hi, I am using Electrum 4.0.2 via AppImage on Linux, with Trezor Wallet with p2wpkh (SegWit native) addresses.

Today I noticed Electrum window dissapear completely from MATE's taskbar panel. However, Electrum processes were still running. I killed processes and restarted Electrum again, also I enabled logging. Few hours later, Electrum dissapeared again - right after I clicked "View transaction on blockchain" on my History tab. Page successfully opened in my browser, but Electrum window is now completely gone. Log is still being populated, as I have text editor notification that file has changed on disk, do you want to reload the file? Processes running:

$ ps aux |grep electrum
pioruns    89321  2.2  1.1 5703448 184592 ?      Sl   15:23   4:52          |   \_ /tmp/.mount_electrOI7vfa/usr/bin/python3.7 -s /tmp/.mount_electrOI7vfa/usr/bin/electrum
pioruns    89420  0.0  0.7 5060312 116288 ?      S    15:24   0:00          |       \_ /tmp/.mount_electrOI7vfa/usr/bin/python3.7 -s /tmp/.mount_electrOI7vfa/usr/bin/electrum
pioruns    93960  0.0  0.7 5138016 126212 ?      S    18:55   0:00          |       \_ /tmp/.mount_electrOI7vfa/usr/bin/python3.7 -s /tmp/.mount_electrOI7vfa/usr/bin/electrum
pioruns    94058  0.0  0.0   6080   892 pts/2    S+   18:56   0:00          |       \_ grep --color=auto electrum
pioruns    89327  0.0  0.0  14216  2492 ?        Ssl  15:23   0:01 /home/pioruns/Electrum/electrum-4.0.2-x86_64.AppImage

Snipper from log - it begins with fiat query, I think that's when I clicked History tab:

20200717T175349.480598Z |     INFO | exchange_rate.Kraken | getting fx quotes for GBP
20200717T175349.743999Z |     INFO | exchange_rate.Kraken | received fx quotes
20200717T175349.745389Z |     INFO | gui.qt.history_list.HistoryModel | refreshing... reason: fx_quotes
20200717T175349.748349Z |    DEBUG | util.profiler | Abstract_Wallet.get_full_history 0.0027
20200717T175349.750533Z |    DEBUG | util.profiler | HistoryModel.refresh 0.0051
20200717T175349.750796Z |    DEBUG | util.profiler | AddressList.update 0.0000
20200717T175349.972019Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175350.889225Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175351.018612Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175355.156137Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175356.584476Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175358.344527Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175427.734298Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175434.175066Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175442.181584Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}
20200717T175446.474981Z |     INFO | network | fee_histogram [[102, 116494], [86, 93555], [78, 142151], [76, 177146], [74, 96220], [71, 161182], [69, 182728], [68, 186781], [66, 247742], [65, 190117], [64, 350011], [63, 325184], [62, 296663], [59, 234014], [57, 625801], [56, 2585813], [55, 56941], [54, 62591], [53, 172244], [52, 68352], [51, 143497], [47, 679621], [41, 926271], [36, 863480], [30, 1045128], [22, 891991], [20, 1267917], [17, 1650435], [14, 1636925], [13, 1344823], [11, 2230623], [10, 1427310], [6, 1962210], [3, 2759281], [2, 2174864], [1, 15610316]]
20200717T175447.720091Z |     INFO | network | fee_estimates {25: 62037, 10: 62037, 5: 64748, 2: 68303}

But after that there is nothing, Electrum continues to run as normal, doing network fee estimates. Opening AppImage does nothing at the moment, window will not appear. I have to kill all processes so I can start Electrum again.

System details from log:

20200717T142334.729262Z |     INFO | logging | Electrum version: 4.0.2 - https://electrum.org - https://github.com/spesmilo/electrum
20200717T142334.735790Z |     INFO | logging | Python version: 3.7.7 (default, Jun 28 2018, 19:01:02) 
[GCC 5.4.0 20160609]. On platform: Linux-5.6.0-0.bpo.2-amd64-x86_64-with-debian-10.4

I will be happy to provide further logs. Thanks

github12101 commented 4 years ago

There is definitely bugs in History Tab. I was able to "dissapear" Electrum window again. I chose "View on block explorer" on one unconfirmed transaction, it successfully opened the page. Then I did that again on other, confirmed transaction, page opened and Electrum window dissapeared immediately.

I killed all Electrum processes. Started it again. This time, on opening second or third link, Electrum window froze completely, I had to kill it again.

github12101 commented 4 years ago

Window froze again, upon opening fourth link. Log shows nothing, just fee_estimates info.

SomberNight commented 4 years ago

I was able to "dissapear" Electrum window again. I chose "View on block explorer" on one unconfirmed transaction, it successfully opened the page. Then I did that again on other, confirmed transaction, page opened and Electrum window dissapeared immediately.

Is the only way you have found to trigger this bug when clicking "View on block explorer" for a tx/address? Does it also happen if you don't use that functionality?

github12101 commented 4 years ago

Yes, it appear so. Window either disappear completely or freeze when I click "View on block explorer" option, not every time, but try few times and it will happen.

EDIT: Just tried it again. As soon as I clicked View on block explorer and continue to click transaction on my history tab, Electrum response to my clicks was slower and slower until it freezes. It happens only after "View on block explorer", haven't experienced it elsewhere.

github12101 commented 4 years ago

Also, other wallets I had opened also froze. Every Electrum window is frozen. DE MATE asked if I want to close unresponsive window, I clicked yes on both Electrum wallets, they are gone. However, processes are still running in the system:

$ ps |grep electrum |grep -v grep
user    84101  0.2  0.0  14344  2608 ?        Ssl  11:44   0:00 /home/user/Electrum/electrum-4.0.2-x86_64.AppImage
user    84205  0.0  2.3 6036292 378056 ?      S    11:45   0:00 /tmp/.mount_electr93C1uv/usr/bin/python3.7 -s /tmp/.mount_electr93C1uv/usr/bin/electrum

They must be killed first otherwise I cannot use Electrum at all, opening new process will do nothing.

EDIT: Another attempt: I had to open 3 links to freeze Electrum, I was scrolling up and down history in my watch-only wallet for 30 seconds to actually freeze it. So it's not happening always but you have pretty good chance to experience this every time you click that option. Windows force closed by MATE DE, processes left running behind:

$ ps |grep electrum |grep -v grep
user    84367  0.4  0.0  14248  2356 ?        Ssl  11:51   0:00 /home/user/Electrum/electrum-4.0.2-x86_64.AppImage
user    84461  0.0  2.3 6035292 380084 ?      S    11:52   0:00 /tmp/.mount_electrrD2yx2/usr/bin/python3.7 -s /tmp/.mount_electrrD2yx2/usr/bin/electrum
user    84527  0.0  2.3 6035292 377604 ?      S    11:52   0:00 /tmp/.mount_electrrD2yx2/usr/bin/python3.7 -s /tmp/.mount_electrrD2yx2/usr/bin/electrum
user    84577  0.0  2.3 6035292 377664 ?      S    11:52   0:00 /tmp/.mount_electrrD2yx2/usr/bin/python3.7 -s /tmp/.mount_electrrD2yx2/usr/bin/electrum

Clicking icon spawns another electrum-4.0.2-x86_64.AppImage process, but no visible windows.

TheFungineer commented 4 years ago

"View on block explorer" confirmed reproduced this bug on my setup. Even after fresh pc reboot and no hanged electrum process in the background: I | logging | Electrum version: 4.0.2 - https://electrum.org - https://github.com/spesmilo/electrum I | logging | Python version: 3.8.3 (default, May 17 2020, 18:15:42) [GCC 10.1.0]. On platform: Linux-5.7.10-zen1-1-zen-x86_64-with-glibc2.2.5 I | logging | Logging to file: None I | logging | Log filters: verbosity '*', verbosity_shortcuts '' Traceback (most recent call last): File "/usr/bin/electrum", line 376, in fd = daemon.get_file_descriptor(config) File "/usr/lib/python3.8/site-packages/electrum/daemon.py", line 84, in get_file_descriptor request(config, 'ping') File "/usr/lib/python3.8/site-packages/electrum/daemon.py", line 111, in request return fut.result(timeout=timeout) File "/usr/lib/python3.8/concurrent/futures/_base.py", line 441, in result raise TimeoutError() concurrent.futures._base.TimeoutError

github12101 commented 4 years ago

Bug still exist in Electrum 4.0.3. I just chose "View on block explorer" from History tab and Electum window froze completely. I had to kill the process and start it again.

ValdikSS commented 3 years ago

The fix is in #6820. os._exit() should be used for child processes, not sys.exit().

https://docs.python.org/3/library/os.html?highlight=os#module-os

Note The standard way to exit is sys.exit(n). os._exit() should normally only be used in the child process after a fork().

ValdikSS commented 3 years ago

To fix the issue right now, before the patch would be applied and new version released, you can fix it yourself and repack appimage file.

  1. Download latest Electrum .appimage from the official website.
  2. Download appimagetool (appimagetool-x86_64.AppImage)
  3. Execute ./electrum-4.0.6-x86_64.AppImage --appimage-extract
  4. Apply the patch or manually change squashfs-root/usr/lib/python3.7/site-packages/electrum/gui/qt/util.py
  5. Repack the appimage file: ./appimagetool-x86_64.AppImage squashfs-root
ValdikSS commented 3 years ago

Fixed in 4.0.7.