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

Closing GUI After Wallet Open for a While Results in Infinite Loading Animation #3840

Closed
elibroftw opened this issue Feb 14, 2022 · 100 comments
Closed

Comments

@elibroftw
Copy link

elibroftw commented Feb 14, 2022

OS: Windows

If I open a wallet at the start of the day, and close it at the end of the day (using Alt + F4), I get a "Closing wallet" loading screen that never goes away. I have to alt-f4 again to close the UI but I still see the process running in Task Manager
image

This issue cannot be reproduced by simply opening and closing the wallet. It happens if I have the wallet open for hours. It may be able to reproduce if you have the wallet open for 10 minutes, but I'm not sure.

Furthermore, when I log out the wallet, I get presented with the Welcome to Monero screen instead of the select wallet screen. I know it's a separate issue, but usually when people log out of one wallet, it's to open the other wallet, not to create a new wallet or something, because that's a one time thing, whereas the open another wallet happens everytime after.

Another feature request is to add a wallet_name[view-only].monero_gui file to the wallet directories that can be double clicked.

Another Bug, is clicking on monero: links opens a new instance of the GUI and doesn't even auto fill the data. What I expect is for the existing GUI to focus and auto fill the data or at least the new instance to autofill the data. I think you could use IPC to inform the existing instance of the data. In my application, I make a post request to 127.0.0.1 with the relevant data.

@elibroftw
Copy link
Author

When decorations are off, the closing works (for now), but try to close the wallet also results in an infinite loop.
image

@selsta
Copy link
Collaborator

selsta commented Feb 18, 2022

Just to confirm, is your wallet fully synced?

@elibroftw
Copy link
Author

elibroftw commented Feb 18, 2022

Yes, you can see the blurry two orange bars.

@selsta
Copy link
Collaborator

selsta commented Feb 18, 2022

So pressing the X button works, but pressing the close button in Settings doesn't?

@elibroftw
Copy link
Author

Yes, but note that the decorations are off. With decorations enabled, both closing the wallet and closing the GUI result in infinite loops.

@selsta
Copy link
Collaborator

selsta commented Feb 18, 2022

Thanks, that might give me a tip on where to look.

@elibroftw
Copy link
Author

image
It happened even with decorations off

@selsta
Copy link
Collaborator

selsta commented Feb 22, 2022

Can you go to the main menu, then click on "Change wallet mode" and then enable the portable mode checkbox.

Afterwards can you check if you still have issues with closing getting stuck?

@elibroftw
Copy link
Author

Issue still occurs even in portable mode

@mj-xmr
Copy link
Contributor

mj-xmr commented Mar 22, 2022

@elibroftw : Does this also happen on an external node, or only local?

@selsta
Copy link
Collaborator

selsta commented Mar 22, 2022

From what others have reported, local or remote node doesn't matter. Happens with both.

@mj-xmr
Copy link
Contributor

mj-xmr commented Apr 1, 2022

So far I couldn't reproduce it in neither Win7 under a VM, nor native Win10. From my prior experience with GUIs, such symptoms result from threads in a deadlock. To continue on this issue, I will simply focus on examining how the threads are being destroyed upon exit and simulate failures there. In fact, during creation of my autogenerated reports I experienced such deadlocks as well.

@elibroftw : May I know your network speed in Mb/s? I'm trying to find clues.

@elibroftw
Copy link
Author

elibroftw commented Apr 1, 2022

50 down 10 up

@selsta
Copy link
Collaborator

selsta commented Apr 1, 2022

@devhyper did you ever run into this issue on Windows?

@devhyper
Copy link
Contributor

devhyper commented Apr 1, 2022

I don't think I experienced this, but I'll check again later today.

@selsta
Copy link
Collaborator

selsta commented Apr 1, 2022

Thanks! Having the GUI open for a while helps with reproducing.

@MajesticBank
Copy link

I have same issue happening on Debian in Virtual machine.

GUI didn't want to cooperate displaying Closing wallet after trying to close the GUI with X, after stopping monerod it changed to "Checking local node status"

Since I couldn't restart that Virtual machine I've moved it to another Desktop and it's still spinning around Monero logo for 3 days.

It does not impact working of monerod and using that wallet from monero-cli / monero-rpc.

@selsta
Copy link
Collaborator

selsta commented Apr 2, 2022

@MajesticBank still stuck at "Checking local node status"? Might be a different thing then.

@MajesticBank
Copy link

Yes, it just hang on that "Checking local node status" and like every 30-45 seconds I see spike of cpu usage on that GUI process.

Not sure how reproducible it might be

@devhyper
Copy link
Contributor

devhyper commented Apr 7, 2022

Sorry for the delay, I was away this weekend and completely forgot.

I was able to reproduce the issue, the GUI was open for around 5 hours.
Remote node, native Windows 10.

@selsta
Copy link
Collaborator

selsta commented Apr 7, 2022

@devhyper Any idea how to debug it? I tried WinDbg but wasn't even able to get a simple backtrace like in gdb.

@elibroftw
Copy link
Author

We should think about it holistically. I.e which qml file is responsible for showing the loader -> which variable controls the loader showing -> when is the variable supposed to change -> when does the variable actually change.

This can avoid using the debugger. Unless of course this issue is a bug in a library.

@mj-xmr
Copy link
Contributor

mj-xmr commented Apr 7, 2022

This can avoid using the debugger. Unless of course this issue is a bug in a library.

Yes. I was able to solve a hard problem like this without any debugger, by simply bisecting the active lines of code. The luxury I was having then was that it was reproducible on my machine.

@elibroftw
Copy link
Author

elibroftw commented Apr 7, 2022

https://github.com/monero-project/monero-gui/blob/master/src/libwalletqt/WalletManager.cpp#L215

Either the mutex is broken here, the address(0,0) is broken, or async is broken. My order of presumptions is mutex, address(0,0), and then async might be broken.

p.s I don't understand why a qstring is returned. Isn't void enough? Unless some other code is also calling this function.

@mj-xmr
Copy link
Contributor

mj-xmr commented Apr 7, 2022

Thanks for the clue. I'll try to simulate these situations via proper tests.

@selsta
Copy link
Collaborator

selsta commented Apr 7, 2022

I guess that works as a first step :D selsta@09a33b9

@selsta
Copy link
Collaborator

selsta commented Apr 9, 2022

I need someone who can use this binary and reproduce the close bug: https://github.com/selsta/monero-gui/suites/5993379160/artifacts/206729904

It will open a cmd window in addition to the GUI and print some debug info so we can check where exactly it gets stuck. I can't reproduce the issue consistently in my VM so someone who gets the issue more often would be helpful.

@elibroftw maybe?

@elibroftw
Copy link
Author

I don't see any output in the command line during the infinite loop.

@selsta
Copy link
Collaborator

selsta commented Apr 9, 2022

I need the output before the infinite loop.

@elibroftw
Copy link
Author

elibroftw commented Apr 9, 2022

2022-04-09 15:46:39.407 W Retrying to obtain clipboard.
2022-04-09 15:52:32.324 W Retrying to obtain clipboard.
2022-04-09 16:26:23.062 W Retrying to obtain clipboard.
<infinite loop happens 30 seconds before next line>
2022-04-09 16:26:23.815 W Retrying to obtain clipboard

@elibroftw
Copy link
Author

elibroftw commented Apr 21, 2022

Or wait, whatever is supposed to make Alive = 0 is not working. Yeah there needs to be added comments there to inform developers how Alive is supposed to become 0 without explicitly setting it to 0.

@elibroftw
Copy link
Author

elibroftw commented Apr 21, 2022

Hmm interesting, https://github.com/monero-project/monero-gui/blob/master/src/qt/FutureScheduler.cpp#L94. Therefore, there's another background task that doesn't want to stop. Do we know what all possible background tasks are? If you can't reproduce the issue, would you mind comparing your settings with mine?
image
image

GUI version: 0.17.3.1-release (Qt 5.15.2)
Embedded Monero version: 0.17.3.0-release
Wallet path: C:\Users\maste\Documents\Monero\wallets\main\main.keys
Wallet restore height: 2075544
Wallet log path: monero-storage\monero-wallet-gui.log
Wallet mode: Advanced mode (Remote node), portable
Graphics mode: OpenGL

@selsta
Copy link
Collaborator

selsta commented Apr 21, 2022

I'll try to add logging in a way that we can see which function is involved with the FutureScheduler. And I'll try to use your settings.

@selsta
Copy link
Collaborator

selsta commented Apr 21, 2022

@elibroftw One thing you can quickly test is if you can still reproduce the bug if you have the fiat price ticker disabled. That constantly updates the price and uses async for that.

@elibroftw
Copy link
Author

No difference.

@selsta
Copy link
Collaborator

selsta commented Apr 22, 2022

Ok, then back to more logging.

Edit: Added detailed logging, waiting for build now.

@selsta
Copy link
Collaborator

selsta commented Apr 22, 2022

@elibroftw
Copy link
Author

2022-04-22 19:35:32.262 D Displaying processing splash
2022-04-22 19:35:32.265 I WalletManager::closeWallet() start
2022-04-22 19:35:32.266 I WalletManager::closeWallet() after locker
2022-04-22 19:35:32.266 I WalletManager::closeWallet() if (m_currentWallet == true)
2022-04-22 19:35:32.267 I WalletManager::closeWallet() after address result
2022-04-22 19:35:32.267 D ~Wallet: Closing wallet
2022-04-22 19:35:32.268 D ~Wallet: walletImpl -> stop
2022-04-22 19:35:32.268 I "~Wallet"   FutureScheduler::shutdownWaitForFinished start
2022-04-22 19:35:32.269 I "~Wallet"   FutureScheduler::shutdownWaitForFinished inside while
2022-04-22 19:35:47.254 D Already seen <5807601b7ceecb60402e32ed4ff9d693a3c279de3534c788b0c47f5b4dff260a>, and not for us, skipped
2022-04-22 19:35:47.255 D Already seen <7f70bb50977e29fbd3abbd624875f3c367c27eee82a6567638ef039cc6f1c911>, and not for us, skipped
2022-04-22 19:35:47.256 D Already seen <41bc809803c51b388fa172cc6c170dd006cad84f539f9cd052cfbafa4f2c8f33>, and not for us, skipped
2022-04-22 19:35:47.256 D Already seen <be11dee162b3fdc90117934d826a174296d7c1435bc7926cb5e398462150d247>, and not for us, skipped
2022-04-22 19:35:47.256 D Already seen <ced7010112d881ac15ac53bd924337c3339d5dc5aa5e017f3162825af1d46a51>, and not for us, skipped
2022-04-22 19:35:47.257 D Already seen <435ea99648933148973b3dee9165c6417306924e833082cd386d2c6e5d901d68>, and not for us, skipped
2022-04-22 19:35:47.257 D Already seen <86806b246cec3d2eea367bde363956e3def49056e424799c55488abfe43d0876>, and not for us, skipped
2022-04-22 19:35:47.257 D Already seen <1d2df45419ff4bdbf596b70c3f70e34ea41099cb169c355effc8c6d63aff0a95>, and not for us, skipped
2022-04-22 19:35:47.258 D Already seen <fc9c0ebeca708c7448cabedbd40cf14ce0f5c38e4ac26e7665da4b6e9b9632a5>, and not for us, skipped
2022-04-22 19:35:47.258 I Found new pool tx: <df70849a3e7216dd7a32747b0f486befbabe4efaa192a74a56d8d8da11446da5>
2022-04-22 19:35:47.258 I Found new pool tx: <395f3932cbd30ca96918c7e99ec19e03c4fcbfa69e24daf54a80b0c955fa50a7>
2022-04-22 19:35:47.259 I Found new pool tx: <6b3a2a3e64189afca50ec7a3827e4de36eadab8c83487eee6e692b4b67a655b2>
2022-04-22 19:35:47.259 D Already seen <4c5f3b5241a39aa08ba4814e1d2551bfcf3a73a9659038010c6ecf9fb53522c4>, and not for us, skipped
2022-04-22 19:35:47.259 D Already seen <7e288ce570d674824cf10cf8bf2049a2dbf704cbdada506d1bd32548636f5edd>, and not for us, skipped
2022-04-22 19:35:47.260 D Already seen <849a112a08ff26229888a388ed8752e05cbb59c4b89431af55accb3572ad91dd>, and not for us, skipped
2022-04-22 19:35:47.260 D Already seen <00daa3d56e68993ceab73655e70398db3b7cd3ad10775220f996dfadc41dedf5>, and not for us, skipped
2022-04-22 19:35:47.261 D asking for 3 transactions
2022-04-22 19:35:47.380 D Got 1 and OK
2022-04-22 19:35:47.381 I Refresh done, blocks received: 0, balance (all accounts): 11.852265634009, unlocked: 11.852265634009
2022-04-22 19:35:47.381 D refreshed
2022-04-22 19:35:47.482 I "startRefreshThread"   FutureScheduler::stopping() start
2022-04-22 19:35:47.483 I "Wallet startRefreshThread"   FutureScheduler::run(no callback) before done
2022-04-22 19:35:47.483 I "Wallet startRefreshThread"   FutureScheduler::done() start
2022-04-22 19:35:47.484 I "Wallet startRefreshThread"   FutureScheduler::done() before locker mutex
2022-04-22 19:35:47.484 I "Wallet startRefreshThread"   FutureScheduler::done() after locker mutex
2022-04-22 19:35:47.484 I "Wallet startRefreshThread"   FutureScheduler::done() before wakeAll
2022-04-22 19:35:47.485 I "Wallet startRefreshThread"   FutureScheduler::done() end
2022-04-22 19:35:47.485 I "~Wallet"   FutureScheduler::shutdownWaitForFinished end
2022-04-22 19:35:47.485 D trimming to 2230561, offset 2230561
2022-04-22 19:35:47.486 I "Wallet startRefreshThread"   FutureScheduler::run(no callback) after done
2022-04-22 19:35:47.486 D trimming to 2230561, offset 2230561
2022-04-22 19:35:47.552 D Wallet cache stored successfully
2022-04-22 19:35:47.553 I ~WalletImpl
2022-04-22 19:35:47.553 D pauseRefresh: refresh paused...
2022-04-22 19:35:47.554 I closing wallet...
2022-04-22 19:35:47.555 I Calling wallet::stop...
2022-04-22 19:35:47.555 I wallet::stop done
2022-04-22 19:35:47.556 I ~WalletImpl finished
2022-04-22 19:35:47.557 D Problems at ssl shutdown: uninitialized
2022-04-22 19:35:47.558 D Problems at cancel: The file handle supplied is not valid
2022-04-22 19:35:47.558 D Problems at shutdown: The file handle supplied is not valid
2022-04-22 19:35:47.592 D m_walletImpl deleted
2022-04-22 19:35:47.593 I FutureScheduler::~FutureScheduler start
2022-04-22 19:35:47.594 I "~FutureScheduler"   FutureScheduler::shutdownWaitForFinished start
2022-04-22 19:35:47.594 I "~FutureScheduler"   FutureScheduler::shutdownWaitForFinished end
2022-04-22 19:35:47.594 I FutureScheduler::~FutureScheduler end
2022-04-22 19:35:47.595 I WalletManager::closeWallet() after m_currentWallet delete
2022-04-22 19:35:47.595 I WalletManager::closeWallet() end
2022-04-22 19:35:47.596 D Hiding processing splash

This happened on my first try. It took 15 seconds to close.
Subsequent tries were smooth so I'll leave the wallet running overnight to see if the trigger is longer now.

@selsta
Copy link
Collaborator

selsta commented Apr 23, 2022

Did you close it immediately after opening a wallet? From the logs it was still doing wallet refresh in the background.

15 seconds is long but at least it worked in the end.

Edit: That's also why the wallet close was async so that it doesn't appear to freeze in such a case. But that's not too important now as long as it closed.

@elibroftw
Copy link
Author

elibroftw commented Apr 23, 2022

No I closed it after hours. I left it running overnight and it still managed to close. I think it's a good fix then for now. I'll try once more but with the balance currency set to USD instead of XMR.

@selsta
Copy link
Collaborator

selsta commented Apr 23, 2022

I'm not really sure why you can't reproduce the issue now.

I only have extra logging plus #3889 and #3890 but they aren't expected to fix this bug.

@elibroftw
Copy link
Author

Maybe both of them together fix the issue?

@selsta
Copy link
Collaborator

selsta commented Apr 23, 2022

3889 is only relevant when using a local node and 3890 is only relevant when having fiat price enabled. I think you tested without these conditions.

@elibroftw
Copy link
Author

I saw the mining status messages though in the log before even with a remote node #3840 (comment). Or am I mistaken?

@selsta
Copy link
Collaborator

selsta commented Apr 23, 2022

No idea where that comes from again :/

@selsta
Copy link
Collaborator

selsta commented Apr 23, 2022

So what do you think? Should we keep async during close or remove it? I think async is the more correct way but it appears to be slower.

Should I make a binary with master + 3889 + 3890 so that we can double confirm that the bug is fixed?

@elibroftw
Copy link
Author

Yeah make that and make one with async as well so I can see which has the best experience.

@selsta
Copy link
Collaborator

selsta commented Apr 23, 2022

Async: https://github.com/selsta/monero-gui/suites/6233216680/artifacts/221206532

Will make another one for without async.

@selsta
Copy link
Collaborator

selsta commented Apr 24, 2022

@elibroftw
Copy link
Author

Without async is faster and not to mention that if something goes wrong, we'll see a UI freeze rather than an infinite loop.

@selsta
Copy link
Collaborator

selsta commented Apr 24, 2022

Just to confirm, both versions have the close bug fixed?

@elibroftw
Copy link
Author

Yes

@selsta
Copy link
Collaborator

selsta commented Apr 24, 2022

that's frustrating because I don't know what fixed it :D like I said both of these fixes shouldn't apply to your situation #3840 (comment)

@elibroftw
Copy link
Author

I'm running it on my laptop now to double check if it wasn't my PC settings that fixed something.

@elibroftw
Copy link
Author

Works fine on laptop too. I suspect that mining status is to blame for most of this plus the fiat price fetching since I had that enabled too.

@selsta
Copy link
Collaborator

selsta commented Apr 25, 2022

@MoneroArbo Can you also confirm if #3840 (comment) solved the close bug for you?

@MoneroArbo
Copy link
Contributor

MoneroArbo commented Apr 25, 2022

@MoneroArbo Can you also confirm if #3840 (comment) solved the close bug for you?

@selsta wow the new user flow for this version is so much better than the last official release, amazing!

And yeah, it seems not to hang on close either. Made a new wallet, opened an old wallet, opened and closed wallets a few times, with and without Window decorations, even closed it mid scan, all seems to work.

Coincidentally (or not) it also seems to no longer do the thing where the wallet scan gets stuck at 0 blocks remaining.

@selsta
Copy link
Collaborator

selsta commented Apr 25, 2022

ok, thanks for testing! guess I can finally close this

@selsta selsta closed this as completed Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants