Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 8b38654 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Good catch, that window is real. The hold now goes on in |
|
Fixed, and the read turned up two more paths worth closing. The hold is now a count rather than a flag, because offer handling runs on a multi threaded scope and two server offers can overlap; a flag let the first one to finish release the hold while the second was still outstanding. Every wait now ends when the attempt to set that description ends, whether it lands, is refused, or answers an offer that has since been superseded, and an ice restart offer that never goes out releases its own. One deliberate difference from the suggestion: a wait that ends without a description leaves the queued candidates where they are instead of discarding them. A candidate that no longer fits is refused by the connection anyway, while discarding would throw away ones that are still good when the refused description was never going to change the credentials. |
52f0c8b to
e3e12b2
Compare
8e48cb8 to
e3e12b2
Compare
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| fun expectRemoteDescription() { | ||
| executeRTCIfNotClosed { awaitedOffers++ } | ||
| } |
There was a problem hiding this comment.
🔴 Subscriber candidates lost during re-offers
When a server offer arrives, onServerOffer does not call expectRemoteDescription before scheduling its answer. Candidates received before the new description lands reach the old description and can be rejected, breaking the subscriber's new ICE path.
Learn more
A server offer changes the subscriber's remote ICE description. onServerOffer launches the work that applies it, while onTrickle can process a candidate first. With an existing remote description and no pending offer count, addIceCandidate applies that candidate immediately. The new description cannot replay a candidate the peer connection already rejected.
Example: The subscriber has offer A applied. The server sends offer B followed by B's candidate. The answer coroutine has not applied B when the candidate arrives, so the candidate is sent to the peer connection while A is still current instead of waiting for B.
Recommended fix: Open the subscriber's expectRemoteDescription wait synchronously when onServerOffer receives the offer, before launching answerServerOffer. Expose this operation through Transport if needed so it works with the new abstraction. Keep descriptionSettled closing the wait when the offer succeeds or fails.
Was this helpful? React with 👍 or 👎 to provide feedback.
Fixes #1017.
A soft reconnect put the subscriber into an ice restart state, and only
setRemoteDescriptionclears that. The server re-offers the subscriber only when the reconnect moved the participant to another node, so after an ordinary resume the flag stayed set for the life of the transport and every later remote candidate was queued instead of applied. The subscriber could no longer take any 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, which is the conclusion reached in livekit/client-sdk-js#2054.
The test forces a soft reconnect and asserts a subscriber candidate still reaches the peer connection afterwards.