Skip to content

fix: close a peer only once the control tasks queued before have run - #498

Merged
devopvoid merged 1 commit into
mainfrom
fix/close-drains-control
Oct 31, 2026
Merged

devopvoid merged 1 commit into
mainfrom
fix/close-drains-control

Conversation

@devopvoid

Copy link
Copy Markdown
Owner

A WebRTC callback can queue a task behind a peer's teardown, such as a channel the remote side opened, and that task still disposes the native channel. The peer counted as closed before the task ran, so WebRtc.shutdown freed the factory and its threads under it; CI caught the process crashing with SIGBUS in RTCDataChannel.dispose on linux_arm64. The peer now finishes closing in a control task queued after the connection closed. RuntimeCloseTests.closeWaitsForTasksQueuedBehindTeardown fails without the fix.

A callback of WebRTC can queue a task behind a peer's teardown, such as a channel the remote side opened, which then disposes the native channel. The peer counted as closed before that task ran, so the runtime freed the factory and its threads under it, and the process crashed in RTCDataChannel.dispose. The peer now finishes closing in a control task queued after the connection closed.
@devopvoid
devopvoid merged commit 121422f into main Oct 31, 2026
22 checks passed
@devopvoid
devopvoid deleted the fix/close-drains-control branch October 31, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant