Repository navigation
Fix shared UDP socket retention during continual ICE gathering - #331
Open
CapricornFBQ wants to merge 2 commits into
Open
CapricornFBQ wants to merge 2 commits into
CapricornFBQ wants to merge 2 commits into
Conversation
Cover allocation completion, stopping, and port destruction with twelve instances, including session teardown and repeated failed-network regathering. Observe real socket bindings and UDP/TURN payloads. Check retention after UDP removal before removing one of two TURN borrowers. Six instances expose retained bindings before the production fix. Issue: livekit/rust-sdks#1512 Bug: None
Schedule a guarded network-thread check when allocation stops or completes and when a registered port retires. Release the shared socket only after the sequence is terminal and all UDP/TURN registrations are gone. Deferring the check lets port destructors finish using the socket. Existing task safety cancels the check if the sequence is destroyed first, while execution-time state checks preserve future relay allocation and active borrowers. Validation: 25 focused tests pass, including 12 new regression instances and 13 existing controls. The 12 new instances pass with the ownership chain instrumented by ASan in shuffled order. With the old allocator, six instances fail only because retired socket bindings remain. The official GN rtc_p2p_unittests target builds on macOS ARM64 with DCHECKs enabled, and all 25 scoped tests pass after test-helper callback cleanup. The earlier ASan and old-allocator results predate that cleanup. SDK end-to-end validation remains pending. Issue: livekit/rust-sdks#1512 Bug: None
Author
|
@cloudwebrtc, could you review this PR when you have a chance, or suggest an appropriate reviewer? It addresses shared UDP socket retention during continual ICE gathering, and the PR description includes the build and test results. Thank you! |
Author
|
I tried signing the CLA again, but the CLA Assistant page still shows a GitHub API rate limit error for the bot account, and the license/cla check remains pending. Could anyone help me? |
Author
Update: I was able to sign the CLA, and the check has passed.” |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
During continual ICE gathering, repeated allocation on failed networks can retain shared UDP sockets after their ports have been destroyed.
AllocationSequenceowns these sockets and can outlive the ports, allowing unused sockets to accumulate.This change schedules a shared-socket release check when allocation completes, allocation stops, or a registered port is destroyed. The check releases the socket only when the sequence is stopped or completed and no UDP or TURN port registrations remain.
The check runs asynchronously on the network thread so port destructors can finish using the socket. It rechecks the state when executed, and
SafeTaskprevents execution if the sequence has already been destroyed. The change preserves continual gathering and retains sockets needed by active ports or later allocation phases.Related to livekit/rust-sdks#1512.
Validation
rtc_p2p_unitteststarget builds successfully on macOS ARM64 withdcheck_always_on=true.