-
Notifications
You must be signed in to change notification settings - Fork 282
fix: stop putting the subscriber into restartingIce on a reconnect #2054
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
xianshijing-lk
wants to merge
2
commits into
main
Choose a base branch
from
sxian/bound-subscriber-ice-restart-window
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+60
−4
Open
Changes from all commits
Commits
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,13 @@ | ||
| --- | ||
| 'livekit-client': patch | ||
| --- | ||
|
|
||
| Fix the subscriber silently buffering remote ICE candidates after a reconnect | ||
|
|
||
| `triggerIceRestart` put the subscriber into `restartingIce` on every reconnect, but only | ||
| `setRemoteDescription` clears that — and the server re-offers the subscriber only when the | ||
| reconnect moved the participant to a different node. After an ordinary signal-only resume no | ||
| offer arrives, so the flag stayed set for the lifetime of the transport and every subsequent | ||
| remote candidate was queued instead of applied, leaving the subscriber unable to adopt any new | ||
| network path the server proposed. The subscriber no longer enters that state: the server does | ||
| not send candidates ahead of the offer that introduces them, so queueing them gains nothing. |
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.
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.
What this fixes: after any reconnect, the subscriber silently stops applying
remote ICE candidates for the rest of the session.
triggerIceRestart()setsubscriber.restartingIce = true. That flag tellsaddIceCandidateto park candidates inpendingCandidatesinstead of applyingthem, and the only code that clears it is
setRemoteDescription— which runs onthe subscriber only when the server re-offers it, i.e. only when the reconnect
moved the participant to a different node. After an ordinary signal-only resume
no offer arrives, so the flag stays set for the transport's lifetime and every
later candidate is parked. The subscriber can no longer adopt a new network path
the server proposes (route change, NAT rebind, switch to relay), so media can
stall until some unrelated negotiation happens to flush the queue.
The fix: stop setting it. The queueing existed to stop candidates for a new
ICE generation being applied against the old remote description, but the server
never sends them in that order — a same-node resume buffers its candidates until
after the offer is sent, and a reconnect landing on another node drops subscriber
candidates until immediately before the offer is created. So the flag had no
upside and one permanent downside.
After this change nothing can set
subscriber.restartingIceat all: the only= trueis increateAndSendOffer, reachable only for the publisher. Thepublisher's own use is sound and untouched — it's set as an offer is sent, and
the answer clears it.
The line worth making sure a reviewer sees is the asymmetry: the publisher sets the flag alongside an offer that will certainly be answered, so it always clears; the subscriber's was set on the expectation of an offer that usually never comes. That's the whole bug in one sentence.