solana-web3.js: [web3.js] Infinite recursion caused by _updateSubscriptions

Problem

I’m using the version 1.44.1 of @solana/web3.js, to develop an application with high-frequency calling. And the connection between network on my machine and Solana’ Network seems to be not so stable: it’s often to throw error about transaction confirmation timeout In this situation, it suddenly to fastly and infinitely throw errors like follow: image

Here is the key log:

signatureSubscribe error for argument [
  '5R9WXhnHtz5umHHh9LpXXz9CSXjucTbrUPCJV2iQAkUgBX4jQ4UcQYRyta3LbBFZwuMGcKMaqCPiPkyuPT2JPKSr',
  { commitment: 'processed' }
] WebSocket is not open: readyState 0 (CONNECTING)

As you can see, the connection is frantically trying to build up subscriptions on TWO transaction signatures.

Then I found out, the problem was caused in function _updateSubscriptions() in connection.ts: image

Proposed Solution

Maybe you team should fix the logic of error handling. Here’s my humble opinion: if there are some subsciptions failing for too many times(whatever the reason is), they should be directly removed from subscriptions list.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 32 (2 by maintainers)

Most upvoted comments

@dfl-zeke, I upgraded your repro repo to 1.73.3 and can no longer kill it.