Repository navigation
test: write until the watcher hears it in the fs.watch case of module-graph-io.test.ts #45870
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
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.
🟡 (optional) On any run where the watcher never reports, the fixture keeps rewriting watched/f every 5 ms through all ~20 later cases, so the failure report is polluted by unrelated load. The interval at test/js/bun/module-graph/module-graph-io.test.ts:975 is only cleared inside the watch callback at :971; the 10 s fallback at :1005 resolves the case but stops nothing. The sibling interval case at :1051-1052 exports stop() and main.mjs calls it at :1061; this case has no equivalent. Fix: stop the interval and close the watcher on every exit of the case, e.g. return a stop function the driver calls after told.promise settles, or clear it from the fallback path.
Why this was flagged
Trigger: a platform or build where fs.watch delivers no event for the directory within 10 s (the exact failure this PR is fixing on macOS). The case falls through to the fallback at test/js/bun/module-graph/module-graph-io.test.ts:1005 and the loop at :1010 moves on. Nothing clears
again(:975) or closesw(:971), so a synchronous fs.writeFileSync runs every 5 ms from the graph's timer for the rest of the run, until process.exit(0) at :1024. On the base branch a never-reporting watcher left one file and one idle handle; after the diff it leaves a hot timer. On debug and ASAN lanes each write is 10-100x slower, so later timing-sensitive cases can also flip to 'nobody was told', hiding the real culprit. The file's own convention for an interval stimulus (:1048-1062) exports stop() and the driver calls it; REVIEW.md requires every timeout path to clear timers and release resources. Remedy: make the case return a cleanup the driver runs after the case settles, or clear the interval and close the watcher from the fallback.Verification: Triggers only when the fs.watch callback never fires. The interval at test/js/bun/module-graph/module-graph-io.test.ts:975 is cleared only inside the watch callback at :971. The fallback at :1005 resolves the case and the loop at :1010 moves on with nothing stopping the interval or closing
w.process.exit(0)at :1024 means the leaked interval cannot keep the process alive.