test: deflake test-inspect-async-hook-setup-at-inspect · nodejs/node@4ed0c8c · GitHub
Skip to content

Commit 4ed0c8c

Browse files
christianaurichzmaduh95
authored andcommitted
test: deflake test-inspect-async-hook-setup-at-inspect
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> PR-URL: #65584 Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-08-26.md Refs: #65028 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 500b98c commit 4ed0c8c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎test/parallel/test-inspect-async-hook-setup-at-inspect.js‎

Lines changed: 12 additions & 2 deletions

0 commit comments

Comments
 (0)