Repository navigation
fix: disconnect() tears down locally after sending the Leave instead of waiting for the server echo #1208
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
Open
Open
fix: disconnect() tears down locally after sending the Leave instead of waiting for the server echo #1208
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f47c649
fix: complete disconnect() when the server closes the socket without …
hiroshihorie 645baaf
fix: disconnect() tears down locally after sending the Leave instead …
hiroshihorie 29bd5df
Merge remote-tracking branch 'origin/main' into hiroshi/complete-disc…
hiroshihorie 3f6510d
fix: report a client disconnect only once the room is torn down
hiroshihorie 6a6b975
Merge remote-tracking branch 'origin/main' into hiroshi/complete-disc…
hiroshihorie 25bb462
fix: share one teardown between overlapping disconnect() calls, and r…
hiroshihorie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| patch type="fixed" "disconnect() tears the room down locally after sending the Leave instead of waiting for the server to echo it, so it no longer stalls 10 s when the echo is lost. Overlapping disconnect() calls share one teardown and report one disconnect" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Old socket close disrupts immediate reconnect
When
connect()followsdisconnect(), the old socket's delayed close can mark the new connection disconnected.SignalClient._onSocketDisposedoes not distinguish the old socket from the new one, triggering an unnecessary reconnect.Learn more
The signaling client stores connection state for the current socket, but each socket retains the same
_onSocketDisposecallback. On web, LiveKitWebSocketWeb callsWebSocket.close()without waiting for the lateronCloseevent. SignalClient.cleanUp therefore finishes before the old callback runs. A subsequent connect can install a new socket before SignalClient._onSocketDispose receives the old close and marks that new connection disconnected.Example: Disconnect session A on web, then immediately connect session B on the same Room. If A's
onClosefires after B connects, B is marked disconnected and the engine begins reconnecting despite B's live socket.Recommended fix: Bind close callbacks to the socket or connection generation that created them. Ignore closes from sockets that are no longer current; add a web-style delayed-close regression test after reconnect.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid, this is the case #1211 covers. It is stacked on this PR and they merge together. SignalClient now tags each socket's callbacks with a generation that
connect()andcleanUp()advance, so a close reported by a socket that was already replaced is ignored. Covered bya close reported by a replaced socket does not disturb the next connectionintest/core/stale_socket_close_test.dart.