fix: prevent native peer lifecycle leaks#28
Merged
Conversation
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.
Summary
Fix native peer/data-channel lifecycle handling while staying inside the data-channel-first scope.
This prevents late native
datachannelcallbacks from surfacing afterRTCPeerConnection.close(), and prevents an unclosed native peer with a created data channel from keeping the Node process alive. The native cleanup path now closes live peer bindings beforertc::Cleanup(), and refuses data-channel adoption once peer shutdown has started.Verification
npm run checknpm run native:checknpm run buildnpm testnpm run api:checknpm run types:checknpm run e2e:chrome- not run locally; covered by PR CI Chrome E2Enpm run wpt:selection:checknpm run wpt:smokenpm run wpt:smoke:checknpm run wpt:test/npm run wpt:check:strict- not run locally; no updated conformance claimAlso run locally:
node --test --test-timeout=30000 test/basic.test.js,git diff --check.WPT impact
No
wpt-manifest.json, selected WPT result, ordocs/divergences.mdchange. WPT selection remains 620 selected subtests.Browser interoperability
No Chrome harness behavior or coverage change. PR CI Chrome E2E covers the browser-facing path.
Notes
This is a native lifetime and callback-threading fix. The addon remains Node-API-only, and libdatachannel is not edited or re-pinned. The pinned libdatachannel close/reset/cleanup paths were inspected before finalizing the native teardown changes.