WalletConnect / walletconnect-monorepo

WalletConnect Monorepo
Apache License 2.0
1.35k stars 674 forks source link

Wallet on connection error: "Failed to publish payload, please try again." #4337

Open kvnschlndt opened 6 months ago

kvnschlndt commented 6 months ago

Describe the bug On the connection of the wallet this unhandled error is thrown. Some connections are working some are not.

What is the reason? How to avoid this?

Expected behavior No unhandled error thrown

Screenshots

image
ganchoradkov commented 6 months ago

hey @kvnschlndt thank you for the report. Please update to latest (currently 2.11.3) and try again. We've optimized the publish behaviour and should be much more robust especially in slow network conditions

kvnschlndt commented 6 months ago

@ganchoradkov after the update we can see a slightly better performance. Actually time by time we get still the "failed to publish" error.

And also we now get notifications about possible memory leaks:

image

Also it tries to reach the the relayer socket, but the wallet is disconnected from the dApp:

image
ganchoradkov commented 6 months ago

Hey thanks for the response! Do you have any VPNs running while experiencing the issues? Socket stalled happens when the websocket fails to emit onopen event for a whole minute meaning there is definitely something preventing the SDK from reaching the relay.

About the event leak, do you have steps to reproduce? Just leaving the app open for a while?

glitch-txs commented 6 months ago

And also we now get notifications about possible memory leaks:

Seems like you are subscribing to the "disconnect" event more than once, could be a loop or something.

kvnschlndt commented 6 months ago

Hey, to better understand our use case: We have an api service which acts as a wallet for testing purposes. The api can handle 40 connections at the same time. There is no VPN used. If this websocket error occurs we can still connect new wallets and they can connect to the relay. The only thing that has been changed was the update from 2.10.1 -> 2.11.3

The memory leak appears when a lot of wallets are connected. We will switch back to the previous version and compare the performance and errors.

ganchoradkov commented 6 months ago

Thank you for the overview, it seems like it might be a case of improper cleanup of failed connection attempts

If this websocket error occurs we can still connect new wallets and they can connect to the relay.

this means there is an active connection and the error is logged by a past attempt

kvnschlndt commented 6 months ago

So comparing the two versions: With 2.10.1 we don´t have the web socket problems + no memory leak notifications. Tho "failed to publish" appears more often.

kvnschlndt commented 5 months ago

@ganchoradkov do you have any news? Its pretty unusable in this state.

image

Still seeing this web socket problems, tho network connection is perfectly good. Is it possible that we are getting blocked because of producing to much requests? 20+ connections can be maintained at the same time.

Updated in the meantime to: 2.12.2

ganchoradkov commented 5 months ago

Hey @kvnschlndt unfortunately I don't have yet any conrete tips at the moment.

Is it possible that we are getting blocked because of producing to much requests?

this shouldn't be the case unless you're sending +10 messages per second

kvnschlndt commented 5 months ago

@ganchoradkov +10 message is unlikely but logically it can happen and it might happen, is it such an error we could see then or would it be a different error?

kvnschlndt commented 5 months ago

@ganchoradkov do you plan to fix the issue? It can be easily reproduced by turning off internet connection, waiting for the first error message, then turning on again. The error then is spammed in the console. image