Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66869 +/- ##
==========================================
- Coverage 90.50% 90.50% -0.01%
==========================================
Files 797 797
Lines 278195 278221 +26
Branches 53453 53461 +8
==========================================
+ Hits 251777 251800 +23
- Misses 16795 16802 +7
+ Partials 9623 9619 -4 🚀 New features to boost your workflow:
|
process.finalization only holds weak references to registered objects. In unregister-function.mjs and finalization-cleanup.mjs the registered objects were not captured by any closure, so a GC before exit could collect them, skipping their exit callbacks and failing the assertions. Reference them from the exit listeners so they stay reachable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DQrzezHzwzfCYeh2cYm2U Signed-off-by: Matteo Collina <hello@matteocollina.com>
mcollina
force-pushed
the
fix-flaky-unregister-function
branch
from
October 20, 2026 11:47
0c42211 to
3aa30fc
Compare
Collaborator
lpinca
approved these changes
Oct 20, 2026
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.
test-process-finalizationflakes on Windows CI in theunregister-function.mjscase:process.finalizationholds registered objects only through weak references, and skips the callback at exit if the object is gone. In the fixture,aandbare top-level bindings that no closure captures, so a GC before exit can collectb. Its exit callback then never runs. The same could hide a broken unregister ofa.finalization-cleanup.mjshas the same problem:firstandthirdare only held bykeptAlive, which nothing captures. Forcing a GC inbeforeExit(--requirea preload doingprocess.once('beforeExit', () => gc())) makes it fail deterministically withactual: []; with this change it passes.Both fixtures now reference the objects from their
exitlistener so they stay reachable until the assertions run. The other fixtures already keep their objects alive this way, or expect them to be collected.🤖 Generated with Claude Code
https://claude.ai/code/session_011DQrzezHzwzfCYeh2cYm2U