test: deflake test-inspect-async-hook-setup-at-inspect - #65584
Open
christianaurichzm wants to merge 1 commit into
Open
test: deflake test-inspect-async-hook-setup-at-inspect#65584christianaurichzm wants to merge 1 commit into
christianaurichzm wants to merge 1 commit into
Conversation
The test sends Debugger.setAsyncCallStackDepth in the same batch as Runtime.enable and Debugger.enable, and treats the command response as proof that async stack recording is on. It is not. While the target runs JS the command is dispatched from a V8 interrupt, where Agent::SyncAsyncHookState() cannot call into JS and defers enabling the async hook to an immediate, answering the command anyway. The `debugger` in the polling interval then pauses the target before that immediate runs, and the nested message loop does not process immediates, so setupTimeoutWithBreak() schedules the timer with the hook still disabled and Debugger.paused arrives without asyncStackTrace. Send the command after the first pause instead. Messages dispatched while the target is paused come from the nested message loop rather than an interrupt, so the hook is enabled inline and the response is the barrier the test assumed it to be. Deferring is deliberate: calling into JS from a V8 interrupt is not safe. This corrects an assumption of the test, not the runtime. Signed-off-by: Christian Aurich <christian.aurichzm@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65584 +/- ##
==========================================
- Coverage 90.07% 90.05% -0.02%
==========================================
Files 751 751
Lines 254875 254875
Branches 48108 48118 +10
==========================================
- Hits 229579 229532 -47
- Misses 16466 16518 +52
+ Partials 8830 8825 -5 🚀 New features to boost your workflow:
|
panva
approved these changes
Aug 27, 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.
parallel/test-inspect-async-hook-setup-at-inspectfailed in 4 PRs in the daily reliability report, on win2019, win2022 and ubuntu2404-x64, always with:The test treats the response to
Debugger.setAsyncCallStackDepthas proof that async stack recording is on. It is not: dispatched from a V8 interrupt, the agent defers enabling the async hook to an immediate that the subsequent pauseprevents from running. Sending the command after the first pause dispatches it from the nested message loop instead, where the hook is enabled inline.
Reproduction
The race window is normally a few microseconds wide. Widening it in the test script makes the failure reliably reproducible:
All measurements are Linux x64 on 16 cores, so the 24 processes are deliberately oversubscribed. All 18 baseline failures carried the signature above.
Unwidened,
node-stress-single-testis weak evidence here: it runs iterations sequentially on an idle worker, where the rate is lower still, and even at the 0.19% measured under contention 100 iterations have an 83% chance of coming backclean. Widened, it needs no concurrency at all - 38 / 40 failures running one process at a time on an idle machine, 34 / 40 pinned to a single core.
Scope
Deferring the hook is deliberate: calling into JS from a V8 interrupt is not safe (#65028). This corrects an assumption in the test, not the runtime. Whether the protocol should expose when the hook becomes active is a separate matter.
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-08-26.md
Refs: #65028