Repository navigation
fix(client): stop endless rejoin loop when ICE never connects - #2482
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughPeer connection failure reporting now uses ICE state to select the failure type. Reconnection handling now distinguishes failures before ICE connects and clears the pre-connect watchdog. Tests cover failure classification and reconnection behavior. ChangesPeer connection failure handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change distinguishes failures before ICE connects and prevents stale watchdog notifications during reconnection. No actionable merge-blocking issue remains; merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change uses existing failure codes and reconnection controls, without an observed increase in privileges or exposure. Failure-event ordering and some downstream behavior remain unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bundle sizeBuilt package output. Sizes in KB; delta vs
|
### 💡 Overview On networks where ICE never connects (e.g. a corporate firewall blocking STUN/TURN), the SDK got stuck in an endless rejoin loop, every ~17s, instead of leaving the call with `webrtc_unsupported_network`. Chrome moves ICE to `disconnected` and the peer connection to `failed` at almost the same time. The peer connection `failed` handler always rejoined with `CONNECTION_FAILED`, without checking whether ICE had ever connected. So the "ICE never connected" counter never went up, and the SDK never gave up. ### 📝 Implementation notes - `BasePeerConnection`: a peer connection `failed` before ICE ever connected now rejoins with `ICE_NEVER_CONNECTED`, so the SDK leaves with `webrtc_unsupported_network` after 2 attempts. It also cancels the pre-connect watchdog, so the same failure can't trigger a second rejoin. Failures after ICE had connected still use `CONNECTION_FAILED`, as before. - `ClientEventReporter`: this failure is now reported as `ICE_CONNECTIVITY_FAILED` instead of `DTLS_CONNECTIVITY_FAILED`. DTLS never starts if ICE doesn't connect. - Tests: added `Publisher` tests for the new reason and the watchdog cancellation, and updated the reporter test for the new label. Verified locally by blocking all media paths in the browser: the SDK now leaves after the second failure, and `call.session_participant_left` carries `reason: "webrtc_unsupported_network"`. 🎫 Ticket: https://linear.app/stream/issue/REACT-1197/endless-rejoin-loop-when-ice-never-connects-webrtc-unsupported-network <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved connection failure reporting so failures are identified as ICE or DTLS connectivity issues based on the connection state. * Improved recovery when a connection fails before ICE connects: the client now requests a rejoin without attempting an ICE restart. * Prevented the pre-connection timeout from triggering a duplicate reconnection notification after a failure has already been handled. <!-- end of auto-generated comment: release notes by coderabbit.ai --> (cherry picked from commit 4a06bff)
|
🎉 The changes from this pull request have been released. Shipped with:
|
💡 Overview
On networks where ICE never connects (e.g. a corporate firewall blocking STUN/TURN), the SDK got stuck in an endless rejoin loop, every ~17s, instead of leaving the call with
webrtc_unsupported_network.Chrome moves ICE to
disconnectedand the peer connection tofailedat almost the same time. The peer connectionfailedhandler always rejoined withCONNECTION_FAILED, without checking whether ICE had ever connected. So the "ICE never connected" counter never went up, and the SDK never gave up.📝 Implementation notes
BasePeerConnection: a peer connectionfailedbefore ICE ever connected now rejoins withICE_NEVER_CONNECTED, so the SDK leaves withwebrtc_unsupported_networkafter 2 attempts. It also cancels the pre-connect watchdog, so the same failure can't trigger a second rejoin. Failures after ICE had connected still useCONNECTION_FAILED, as before.ClientEventReporter: this failure is now reported asICE_CONNECTIVITY_FAILEDinstead ofDTLS_CONNECTIVITY_FAILED. DTLS never starts if ICE doesn't connect.Publishertests for the new reason and the watchdog cancellation, and updated the reporter test for the new label.Verified locally by blocking all media paths in the browser: the SDK now leaves after the second failure, and
call.session_participant_leftcarriesreason: "webrtc_unsupported_network".🎫 Ticket: https://linear.app/stream/issue/REACT-1197/endless-rejoin-loop-when-ice-never-connects-webrtc-unsupported-network
Summary by CodeRabbit