Repository navigation
test: deflake test-worker-message-port-transfer-filehandle-fd0 - #66980
Open
christianaurichzm wants to merge 1 commit into
Open
christianaurichzm wants to merge 1 commit into
christianaurichzm wants to merge 1 commit into
Conversation
The child closed stdin and expected the next open() to return fd 0, but another thread can open a descriptor in between and take it. Pass the file to the child as stdin and wrap fd 0 in a FileHandle, so it is open from the start. After the transfer is discarded, accept an fd 0 that was reused for another file. Signed-off-by: Christian Aurich Zanettini Martins <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66980 +/- ##
==========================================
+ Coverage 90.58% 90.60% +0.02%
==========================================
Files 797 797
Lines 278298 278298
Branches 53523 53513 -10
==========================================
+ Hits 252095 252154 +59
+ Misses 16570 16519 -51
+ Partials 9633 9625 -8 🚀 New features to boost your workflow:
|
Contributor
Author
panva
approved these changes
Oct 25, 2026
Collaborator
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-worker-message-port-transfer-filehandle-fd0closes stdin in a child and expects the nextopen()to return fd 0. That only holds if no other thread opens a descriptor in between, which Node.js does not guarantee: V8's GC threads, for example, read/sys/devices/system/cpu/onlinethe first time they contend on a lock. Onubuntu2404_sharedlibs_withoutssl_x64the test failed twice with17 !== 0, andtest-filehandle-closerecently hit the same kind of fd reuse there (#66750).The parent now passes the test file as the child's stdin, and the child wraps fd 0 in a
FileHandle, so the descriptor is open from the start. After the transfer is discarded, the test accepts an fd 0 that was reused for another file.I could not reproduce the CI failure without forcing the race. With a preload that keeps a worker opening and closing
/dev/zero, the test fails 120/200 onmainand 0/500 with this change, and it still fails 20/20 if~TransferData()skips fd 0 again.Refs: nodejs/reliability#1701
Refs: #66750