Repository navigation
Conversation
Use the local participant’s subscribe permission for the dual-peer reconnect wait and completion checks.
🦋 Changeset detectedLatest commit: ed44a59 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 |
There was a problem hiding this comment.
Devin Review found 1 potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| if (requiresSubscriber(includePublisher)) { | ||
| launch { subscriberState.waitUntilConnected() } | ||
| } |
There was a problem hiding this comment.
🔴 Premature rejoin after subscribe grant
If permission is granted during a publisher-only resume, waitUntilConnected still returns as soon as the publisher connects. isConnected then requires the subscriber. If subscriber ICE is still starting, the engine abandons the resume and starts a full rejoin.
Learn more
The subscriber is the connection that receives remote media. The soft reconnect path starts collecting signaling responses asynchronously through onReadyForResponses. A participant update can therefore change the local subscribe permission while the reconnect waits for ICE. The wait uses the permission at entry, but the final connection check uses it at completion. If these decisions disagree, the reconnect loop moves on to a full rejoin even though the ICE deadline has not expired. onFullReconnecting then tears down remote participant state.
Example: A publisher starts resuming with subscribe permission denied and an idle subscriber peer. A server update grants permission while publisher ICE is still recovering. The publisher connects first and the subscriber is still connecting. The resume fails immediately instead of waiting for the subscriber within the remaining ICE budget.
Recommended fix: Make reconnect readiness observe both permission and peer state until the existing ICE deadline. If the final check observes that the subscriber has just become required, continue waiting within that deadline instead of falling through to a full rejoin. Add a test that grants permission after the wait starts and connects the subscriber after the publisher.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Thanks, I confirmed this race in the reconnect path. waitUntilConnected() decides whether to wait for the subscriber when it starts, while isConnected() reads the latest permission. If a grant arrives before publisher ICE connects, the final check can reject the resume while the subscriber is still connecting and there’s time left in the ICE timeout.
The fix should use one readiness check that observes permission and peer state within the existing ICE timeout. A regression test should grant subscribe permission after the wait starts, connect the publisher first, and verify that the resume completes only after the subscriber connects.
Summary
For a publisher-primary participant whose permissions explicitly deny subscribing, the server can leave the subscriber peer idle. During a reconnect, the Android SDK waits for both peers and checks that both are connected. That can trigger a full rejoin about 20 seconds into a soft reconnect even when publisher ICE and video delivery have recovered.
Use the local participant's subscribe permission from the join response and subsequent participant updates. When the publisher is in use and the subscriber peer is optional, wait for the publisher and use its state to judge completion. Subscriber-primary rooms and rooms whose subscribe permission is granted or unknown retain the subscriber check.
Evidence
DualPeerConnectionTransportTestandRTCEngineMockE2ETest, plus both modules'spotlessKotlinChecktasks. The added tests cover the idle subscriber, the required publisher, and changes to subscribe permission.Merge Danger
Door Reversible SDK change.
Blast radius Reconnects in dual-peer publisher-primary rooms whose publishing participants lack subscribe permission.