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

Web wallet failed sync - Failed sync leads to a hung sync #3227

Open
voidsculptorart opened this issue Dec 18, 2024 · 9 comments
Open

Web wallet failed sync - Failed sync leads to a hung sync #3227

voidsculptorart opened this issue Dec 18, 2024 · 9 comments
Labels
fix:bug Something isn't working module:w3sper Issues related to w3sper SDK

Comments

@voidsculptorart
Copy link

Web wallet failed sync - Failed sync leads to a hanged sync

Linked to issue "Web wallet failed sync - Invalid mnemonic phrase": #3226

Description
When the web wallet can't sync with the node and gets an internal server error from the node, the sync progress bar hangs permanently.

Steps To Reproduce
When the web wallet tries to sync with the node, the node must return an internal server error to the web wallet. I've previously observed this hanged sync (without an error from the node), and the only thing to do was to reload the entire webpage and log in again in the wallet.

Error Screenshots
The "Failed sync" error popped up:
image

After clicking the Resync button, the following error pops up in the dev console:
image

After continuing in the dev console, the progress bar hangs permanently:
image

Expected Behaviour
The sync progress bar should have a Resync button icon which allows the user to resync manually. Perhaps don't allow the resync if less than 5 seconds from the previous sync start have passed.

Platform
Brave desktop browser (normal tab, not private)

@ascartabelli
Copy link
Contributor

So yesterday we had a network problem that may have caused you experiencing those errors.
I understood what may have caused the one I see in your screenshot in #3226 and I have a plan to avoid it, but this would mean only a clear error message obviously because the network needs to be up.

About the sync being stuck: I don't see how that can happen in case of error, because in case of errors you would see the "retry sync" button. So, either the sync was running but was apparently doing nothing because of the network problems, or it was your tinkering with the debugger to stop the execution.

I'll investigate the situation more nonetheless, and I'll prepare a PR in the next days to address the "protocol driver not loaded" problem.

@voidsculptorart
Copy link
Author

voidsculptorart commented Dec 19, 2024

The sync now seems to hang every time I log in, after a few syncs. In this instance, I logged in and left the window open, unattended, for under 1 hour, and the progress bar is now shown permanently. The error from the dev console is the only one, but I have no idea if the two are related; the pause on exceptions options were disabled.

(Further testing showed that "Pause on caught exceptions" must be disabled, and the dev console error always shows up when the sync progress remains displayed permanently, so they are related. The issue also occurs if the dev console isn't open, but it may be necessary for the tab with the wallet to be hidden, that is, another tab may have to be displayed.)

Once I saw the error, I logged in another account, in a private tab, and sent some dusk to the first account, but the recipient's balance didn't update, so it's clear that the sync is indeed hung.

I've attached screenshots with the error, and also the full dev console log.

image
image
apps.dusk.network-1734640510693.log

Below, the selected line in the middle is where the dev console takes me when I click the top file of the stack trace (index.Bkopiw9M.js):
image

And below is for the update in the wallet store (walletStore.DPQaldIZ.js); this to me looks like it's catching all exceptions and returning empty:
image

@dusk-network dusk-network deleted a comment Dec 20, 2024
@ascartabelli
Copy link
Contributor

Ok, I think I understood what's happening, although it's not yet clear to me why it's happening so often to you.
In a nutshell seems that some websocket errors are "eaten" by w3sper and not thrown to the UI, so the sync is stuck because it's waiting either for a "progress" signal or an error one.

Thanks for the detailed report.

And below is for the update in the wallet store (walletStore.DPQaldIZ.js); this to me looks like it's catching all exceptions and returning empty:

No this is completely unrelated and the error didn't happen there.
In any case, out of curiosity: returning an empty string there in case of errors is done on purpose, so that the sync can continue as usual.
The information we're trying to retrieve there have the only purpose of making your next sync quicker: if an error happens on one chunk of data, the next sync will just start from the last "valid" point to ensure cache consistency.

@ascartabelli
Copy link
Contributor

@voidsculptorart a question though: when this last error occurred were you trying to make a shielded transaction or an unshielded one?

@voidsculptorart
Copy link
Author

I wasn't doing anything. I simply logged in the wallet and left it open. I'll test more to see if it's a matter of time / number of syncs, or it matters if the browser tab is hidden. (I tried a public transaction only after the sync hung, to check that it was indeed hung and not just a display artifact.)

@voidsculptorart
Copy link
Author

I've been able to reproduce the error by logging in a new tab (I didn't even open the dev console) and leaving the wallet tab visible. It seems that a minimum number of syncs (or amount of time) has to pass. Interestingly, in the two cases I tested today, the time passed from the first sync to the sync which hanged was 36 minutes (which would make for a total of 8 syncs, including the initial one).

After the sync hanged, I opened the dev console and saw the same event as previously. It seems that the stack trace is shown only if the dev console is open when the error occurs, so it's not visible in this case.
image

@ascartabelli
Copy link
Contributor

The bug itself seems to be what I described here: #3227 (comment)

I verified that we had again problems with nginx last evening / night and this too is being investigated.

I'll close #3228 as duplicate of this, as they seem to point to the very same problem.

@voidsculptorart
Copy link
Author

The wallet started to behave differently, so I thought that a fix was deployed, but it looks like there wasn't any. It seems that the issue has slightly different behaviors at various times.

I'll just add this comment (I initially wanted to make another item), although it probably doesn't add more useful information.

Description
When the user clicks the resync icon in the "Failed sync" error bar, and the wallet receives a websocket error, the wallet does not show the "Failed sync" error bar, and instead permanently shows an early stage of the sync progress bar.

The solution seems to be similar with the one implemented for the fix when the wallet syncs automatically. There seems to be another part of the code where this bug has to be fixed for when the user starts a manual sync operation.

Steps To Reproduce
When the web wallet tries to sync with the node, it must receive a websocket error. The wallet shows the "Failed sync" error bar, as expected.

The user must click the resync icon in the "Failed sync" error bar. The wallet tries to sync, and must still receive a websocket error. The wallet does not show the "Failed sync" error bar, as is expected, and instead permanently shows an early stage of the sync progress bar.

Error Screenshot
After clicking the Resync icon, the wallet permanently shows an early stage of the sync progress bar; the area in the red rectangle is when the manual sync was performed:
image

The same issue just appeared for the automatic sync as well:
image

Expected Behaviour
The "Failed sync" error bar has to be shown again because the wallet received an error during the manual sync.

Platform
Brave desktop browser (normal tab, not private)
Web wallet 0.10.1.

@ascartabelli
Copy link
Contributor

The wallet started to behave differently, so I thought that a fix was deployed, but it looks like there wasn't any. It seems that the issue has slightly different behaviors at various times.

The bug you experienced is the same, it's just different when it happens (see #3227 (comment)).

Some fixed were merged, not the one related to this issue which seems to come from the w3sper's library.
When fix are merged they are not immediately released in the stable app, but you can test them here (for testnet): https://apps.staging.testnet.dusk.network/wallet/

See our changelog to see what is officially released and what is not: on the staging environment linked above you can find the features marked as "unreleased" in the changelog.

Expected Behaviour The "Failed sync" error bar has to be shown again because the wallet received an error during the manual sync.

The problem here as stated in the comment linked above is that the web wallet doesn't receive an error, otherwise it would behave as you're expecting, but the error is just logged in the console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix:bug Something isn't working module:w3sper Issues related to w3sper SDK
Projects
None yet
Development

No branches or pull requests

2 participants