-
Notifications
You must be signed in to change notification settings - Fork 5.1k
CONNECTION ERROR: Provider started to reconnect before the response got received! #3886
Comments
From my understanding, you're hoping that web3js acts stateful and maintains a cache of the web socket events? |
Yes. I hoped ws natively caching pending requests. Should I have to manually store pending requests while provider reconnects? And how to handle this error? provider.on('close', ...) ? |
Typically speaking, we try to be as stateless as possible (there's a few areas where we obviously cannot be). What i would do is perhaps keep track of the last seen block by your application and on a failure case restart using |
Hey there, just wanted to check if Greg's recommendation satisfies your request? |
Not really, I can't imagine how to apply such idea to my needs. This error happens if transaction sent and reconnection happens while i'm waiting for transactionReceipt event. |
@snitovets In case it helps you: In our organisation, we don't rely on waiting for the receipt. There are multiple reasons why we cannot rely on it:
In light of this, we don't really pay much attention to the returned receipts. What do we do instead?
That's obviously more steps, but hopefully a bit more robust. I would also appreciate if anyone has any criticism of our process! |
By the way, did you ever find out why this error was occurring? I would like to compile a list of reasons and solutions in #4016. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
I'm facing the same issue. Error: PollingBlockTracker - encountered an error while attempting to update latest block: @snitovets Did you manage to fix this? |
Having the same error did any one manage to fix it? |
Same error! Any Updates? |
Public and shared RPC instances are restarting WebSocket connections sometimes. Hence we get this error. Using the dedicated RPC instance solved this problem for me |
Yes, we also had to give up on |
Same error! Any Updates? |
I looking for workaround how to handle this error within my app. It was a surprise why websocket not store pending request to resolve after reconnection.
/app/node_modules/web3-core-helpers/lib/errors.js:63
return new Error('CONNECTION ERROR: Provider started to reconnect before the response got received!');
Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
at Object.PendingRequestsOnReconnectingError (/app/node_modules/web3-core-helpers/lib/errors.js:63:16)
at /app/node_modules/web3-providers-ws/lib/index.js:332:37
at Map.forEach ()
at WebsocketProvider.reconnect (/app/node_modules/web3-providers-ws/lib/index.js:331:28)
at WebsocketProvider._onClose (/app/node_modules/web3-providers-ws/lib/index.js:149:14)
at W3CWebSocket._dispatchEvent [as dispatchEvent] (/app/node_modules/yaeti/lib/EventTarget.js:115:12)
at W3CWebSocket.onClose (/app/node_modules/websocket/lib/W3CWebSocket.js:228:10)
at WebSocketConnection. (/app/node_modules/websocket/lib/W3CWebSocket.js:201:17)
at WebSocketConnection.emit (node:events:379:20)
at WebSocketConnection.EventEmitter.emit (node:domain:470:12)
at WebSocketConnection.handleSocketClose (/app/node_modules/websocket/lib/WebSocketConnection.js:389:14)
at TLSSocket.emit (node:events:391:22)
at TLSSocket.EventEmitter.emit (node:domain:470:12)
at node:net:667:12
at TCP.done (node:_tls_wrap:573:7)
Originally posted by @snitovets in #1354 (comment)
The text was updated successfully, but these errors were encountered: