-
Notifications
You must be signed in to change notification settings - Fork 535
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
Prevent reusing the socket after receiving a server_disconnect #647
Prevent reusing the socket after receiving a server_disconnect #647
Conversation
I believe this code path has to check for socket connection. The problem with relying on server_disconnect is that socket can be closed for any reason, including loss of connectivity. Refers to: packages/drivers/odsp-socket-storage/src/OdspDocumentDeltaConnection.ts:123 in 99bc602. [](commit_id = 99bc602, deletion_comment = False) |
But something interesting here is that the connect document flow doesn't have a listener for "disconnect". It should. |
Scenario:
I think you are saying #1 solves the problem, which means (if it does), we do not support that scenario (there is no 2 second window for reuse). In reply to: 557638013 [](ancestors = 557638013) |
The client gets a "server_disconnect" message from the server for "IdleTime" and emits a "disconnect" for the socket. That "disconnect" doesn't close the socket until 2 seconds later. The client then decides to reconnect, and it ends up using that same socket (this a problem). It sends a "connect_document" message, but then the socket is closed by the server and the client waits forever.
When the client gets a "server_disconnect", mark the socket reference as closing. When deltaConnection.disconnect is called, the reference will be removed.