You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using a solana-test-validator along with test-containers and the problem is that the test-validator shuts down without properly closing the connection (I can't signal the validator to shut down nicely, it also happens while running the test-validator on the terminal without docker). This can happen regardless of the context (in a website or a backend), and the reason is that by default the connection creates the RpcWebSocketClient with options:
{
autoconnect: false,
max_reconnects: Infinity,
}
After the test is done and the container is shut down, the output on the console (also in the CI) is:
console.error
ws error: connect ECONNREFUSED 127.0.0.1:55301
at Connection.error [as _wsOnError] (node_modules/@solana/web3.js/src/connection.ts:5079:13)
at Client.emit (../../node_modules/eventemitter3/index.js:181:35)
at WebSocket.<anonymous> (../../node_modules/rpc-websockets/dist/lib/client.js:458:23)
at WebSocket.onError (../../node_modules/rpc-websockets/node_modules/ws/lib/event-target.js:220:18)
at emitErrorAndClose (../../node_modules/rpc-websockets/node_modules/ws/lib/websocket.js:1002:13)
at ClientRequest.<anonymous> (../../node_modules/rpc-websockets/node_modules/ws/lib/websocket.js:854:5)
Add a new method in the connection to clean up resources properly and close the websocket nicely, regardless of the server closing the connection abruptely. I come from the Java world, and one would implement Closeable for this type of use cases.
The text was updated successfully, but these errors were encountered:
I'm rather certain that this is a leak in rpc-websockets (see #25578) and you're right that, unless they are able to plug that leak, the only option for web3.js is to patch around it.
Feel free to reopen this issue if you think it's substantially different than #25578.
Problem
SDK Version: 1.66.2
I'm using a
solana-test-validator
along with test-containers and the problem is that the test-validator shuts down without properly closing the connection (I can't signal the validator to shut down nicely, it also happens while running the test-validator on the terminal without docker). This can happen regardless of the context (in a website or a backend), and the reason is that by default the connection creates theRpcWebSocketClient
with options:After the test is done and the container is shut down, the output on the console (also in the CI) is:
on an infinite loop.
Related issues:
#25931
#25578
Proposed Solution
Add a new method in the connection to clean up resources properly and close the websocket nicely, regardless of the server closing the connection abruptely. I come from the Java world, and one would implement Closeable for this type of use cases.
The text was updated successfully, but these errors were encountered: