Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

web3.js: _updateSubscriptions running in infinite recursion, crashing developed app #1177

Closed
awojciak opened this issue May 11, 2022 · 12 comments · Fixed by solana-labs/solana#25180
Assignees

Comments

@awojciak
Copy link

Problem

When using latest release of @solana/web.js (1.41.4) and getting errors like this one:
obraz
developed app is crashing.
I suspect this happens because of recursion there, which seems to run indefinitely:
obraz
When using version not containing this change in code (1.41.1), crashing doesn't happen.

Proposed Solution

Use one of solutions mentioned in TODO comment ("Maybe add an 'errored' state or a retry limit?")

@steveluscher
Copy link
Contributor

Can't tell @jstarry didn't tell me so! :)

Do you have a reliable repro for this @awojciak; something that you could share with me? Or is this just showing up in your server logs?

@steveluscher
Copy link
Contributor

The presence of the socket not ready error is helpful information though. I'll try to create such an environment synthetically.

@awojciak
Copy link
Author

awojciak commented May 12, 2022

Hi, thanks for the response @steveluscher . Here you can check preview of environment where this situation happens: invariant-labs/webapp#311. Open dev tools console in browser, set network in app to devnet and for example try to swap two tokens (use faucet to get our mock tokens) - then app will freeze and console will be full of these errors. I hope this will be helpful.

@steveluscher
Copy link
Contributor

steveluscher commented May 12, 2022

I stood the app up, but every time I use the dropdown to switch to devnet the whole app refreshes and returns to mainnet-beta. What am I missing?

Nevermind. I tried Chrome and it worked. You might like to test the app on Firefox – you might have a bug there that causes the whole page to refresh!

@awojciak
Copy link
Author

I stood the app up, but every time I use the dropdown to switch to devnet the whole app refreshes and returns to mainnet-beta. What am I missing?

Nevermind. I tried Chrome and it worked. You might like to test the app on Firefox – you might have a bug there that causes the whole page to refresh!

Weird, I've looked now on app on Firefox, network change works fine (but refresh is an intended behavior in this case)

@steveluscher
Copy link
Contributor

image

One interesting thing I notice is that you're making a lot of accountSubscribe subscriptions, one for every token in a long list of tokens. What's the idea behind this? I wonder if this high volume of subscriptions is related to your disconnects.

@awojciak
Copy link
Author

image

One interesting thing I notice is that you're making a lot of accountSubscribe subscriptions, one for every token in a long list of tokens. What's the idea behind this? I wonder if this high volume of subscriptions is related to your disconnects.

I think these might be subscriptions for user tokens accounts, to fetch latest balances.

@steveluscher
Copy link
Contributor

Screen.Recording.2022-05-12.at.5.09.08.PM.mov

Interestingly, after these many accountSubscribe subscriptions are made, the sockets repeatedly close with error 1013 Try again later (‘Temporary server condition forced blocking client's request’).

@steveluscher
Copy link
Contributor

OK. I think I have a fix to make, but the larger curiosity is why the devnet socket server keeps closing the connection on you (with a 1013) error.

@steveluscher
Copy link
Contributor

Try the latest version of web3.js @awojciak. I think your infinite recursion problem will be fixed, but the fact that devnet drops the socket on you with a 1013 is a separate problem, perhaps related to the sheer number of subscriptions that the app makes.

@awojciak
Copy link
Author

@steveluscher App still freezes and there is a lot of these errors:
image
Code line indicated in error:
image
For me it seems like there is still some recursion retrying way too many times. Here you can check preview: invariant-labs/webapp#312 - reproduction steps are the same as earlier. Anyway, thanks for your help.

@github-actions
Copy link
Contributor

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants