Skip to content

fix: prevent native peer lifecycle leaks#28

Merged
mertushka merged 1 commit into
mainfrom
fix-native-peer-lifecycle
Jun 24, 2026
Merged

fix: prevent native peer lifecycle leaks#28
mertushka merged 1 commit into
mainfrom
fix-native-peer-lifecycle

Conversation

@mertushka

@mertushka mertushka commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

Fix native peer/data-channel lifecycle handling while staying inside the data-channel-first scope.

This prevents late native datachannel callbacks from surfacing after RTCPeerConnection.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 before rtc::Cleanup(), and refuses data-channel adoption once peer shutdown has started.

Verification

  • npm run check
  • npm run native:check
  • npm run build
  • npm test
  • npm run api:check
  • npm run types:check
  • npm run e2e:chrome - not run locally; covered by PR CI Chrome E2E
  • npm run wpt:selection:check
  • npm run wpt:smoke
  • npm run wpt:smoke:check
  • npm run wpt:test / npm run wpt:check:strict - not run locally; no updated conformance claim

Also run locally: node --test --test-timeout=30000 test/basic.test.js, git diff --check.

WPT impact

No wpt-manifest.json, selected WPT result, or docs/divergences.md change. 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.

@mertushka mertushka changed the title Fix native peer lifecycle leaks fix: prevent native peer lifecycle leaks Jun 24, 2026
@mertushka mertushka changed the title fix: prevent native peer lifecycle leaks fix: prevent native peer lifecycle leaks Jun 24, 2026
@mertushka mertushka merged commit 83abc42 into main Jun 24, 2026
19 checks passed
@mertushka mertushka deleted the fix-native-peer-lifecycle branch June 24, 2026 17:55
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