Repository navigation
Conversation
AbortSignal.any() copies the source WeakRefs of a composite input into the new composite, so nested composites share them. Those WeakRefs were also used as the unregister tokens for the registrations that prune a composite's sources once they are collected. When an inner composite was collected first, its cleanup therefore also unregistered the outer composite from the same sources. An observed outer composite then stayed in gcPersistentSignals, together with its listeners, even after all of its sources were gone and nothing could abort it anymore. Use each composite's own WeakRef as the unregister token instead, so collecting one composite only removes its own registrations. Fixes: nodejs#66612 Refs: nodejs#62367 Assisted-by: Claude Code Signed-off-by: journaltraces <kxenk@protonmail.com>
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66617 +/- ##
==========================================
- Coverage 92.78% 90.43% -2.35%
==========================================
Files 422 791 +369
Lines 193692 276587 +82895
Branches 29881 53112 +23231
==========================================
+ Hits 179714 250135 +70421
- Misses 13650 16860 +3210
- Partials 328 9592 +9264
🚀 New features to boost your workflow:
|
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.
Fixes: #66612
Refs: #62367
AbortSignal.any()copies the sourceWeakRefs of a composite input into the new composite, so nested composites share them. Since #62367 thoseWeakRefs are also the unregister tokens ofsourceSignalsCleanupRegistry. When the inner composite is collected first, its cleanup therefore also unregisters the outer composite, and an observed outer composite stays ingcPersistentSignalsafter all of its sources are gone.This uses each composite's own
WeakRefas the unregister token, so collecting one composite only removes its own registrations.The new test in
test-abortsignal-drop-settled-signals.mjsfails without the change and passes with it. The reproduction from the issue goes from 8/8 to 0/8 retained composites.