-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebsocketProvider disconnect method doesn't close the connection when provider is trying to reconnect #2882
Comments
Thanks for opening this issue! I will test and if required fix it asap. |
Any update on this? I'm seeing the same behavior (2.0.0-alpha): when trying to attempt to a node without WS interface enabled, auto-reconnect logic kicks in, i.e. attempts reconnect every few seconds. So far so good, but calling The instance is now a zombie, continually trying to reconnect to a non-existent or non-responsive endpoint, with no way to terminate it. Overwriting the instance with a new one doesn't help; the network monitor shows continuous reconnect attempts. There really should be a global But more narrowly, calling |
@7-of-9 We are informed about this behaviour but as long as the connected node doesn't close the connection in a clean manner is it impossible for us to handle the manual closing case well. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment, otherwise this issue will be closed in 7 days |
I know it's been a while since the issue was raised; is there any update on its fix?
Even if the connected node doesn't close the connection cleanly, it seems like it should be possible to address this with a boolean variable in the provider object (e.g. 'disconnectCalled') that is default-false and set to true on the first line of the disconnect() handler. Auto-reconnection could check this value before each attempt and if it's true, quit making attempts to reconnect. After successful reconnection, check it again and if true at that point, do the clean disconnection that would've been done if the provider were connected at the time disconnect() was called. |
Description
WebsocketProvider
disconnect
method doesn't close the connection when provider is trying to reconnectExpected behavior
Calling
provider.disconnect()
should always terminate the websocket connection.Actual behavior
Calling
provider.disconnect()
doesn't terminate the websocket connection when the provider is trying to reconnect.Steps to reproduce the behavior
run a local node with websocket
run the following code with Nodejs
process logs:
process logs:
the process should log
close
and exit asprovider.disconnect()
has been called.Versions
Note
Also tested with current code including #2711 correction:
The text was updated successfully, but these errors were encountered: