Repository navigation
test: hold the UDP port until the graph's socket is bound in module-graph-io.test.ts #45871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
dylan-conway
wants to merge
1
commit into
main
from
claude/module-graph-io-udp-port-held-until-bound
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟣 pre-existing, not blocking: The test can still hang or go wrong when another process takes the freed port, and after merging this remains a flake for CI runs of this file. After close() at test/js/bun/module-graph/module-graph-io.test.ts:1058 the port is free while the tenant keeps sending every 5 ms; a sibling case in the same describe.concurrent binds port 0 at line 937 with
data: boomand never closes it, so if it is handed that port the datagrams are delivered, not refused, andboomfires in the sibling for a packet it never expected. Fix: keep the port taken for the whole test (hold the host socket and make the graph socket's error come from a port that cannot be reassigned, e.g. an unroutable or firewalled target, or assert with a bounded deadline and a stated reason).A small fix can ride a push you are already making; otherwise a short reply is enough.
Why this was flagged
The sibling test at test/js/bun/module-graph/module-graph-io.test.ts:898 runs concurrently as its own process (describe.concurrent) and its cases at lines 937 and 954 bind UDP port 0 on 127.0.0.1; the line-937 Bun.udpSocket is never closed, so it lives until that process exits (up to the 60 s timeout at line 1038). After
await close()at line 1058 the port P is free, and the kernel can hand it to that sibling bind. Then every 5 ms send from tenant.mjs line 1048 is delivered to the sibling's socket: no ICMP unreachable, no on_recv_error (src/runtime/socket/udp_socket.rs:97), nograph: ECONNREFUSED, and the sibling'sdata: boomruns for a packet from another test. On base (line 1055 old closedUdpPort) the port was freed earlier, so the exposure is not widened, but this residual path still makes the awaited promise at line 1059 wait for an unrelated process to exit. Remedy: keep the port owned (or the error source deterministic) for the whole test rather than freeing it mid-test.Verification: Pre-existing and narrowed by this PR. After
await close()at /home/claude/bun/test/js/bun/module-graph/module-graph-io.test.ts:1058 the host's dgram socket no longer owns P; if another socket binds P before the tenant's next send draws ICMP port-unreachable, every 5 ms "x" is delivered instead of refused, andawait promiseat line 1059 never settles. Nothing in the diff rules this out.