Skip to content

debugger: wait for initial break render during startup - #64189

Closed
inoway46 wants to merge 1 commit into
nodejs:mainfrom
inoway46:debugger-initial-break-render-wait
Closed

debugger: wait for initial break render during startup#64189
inoway46 wants to merge 1 commit into
nodejs:mainfrom
inoway46:debugger-initial-break-render-wait

Conversation

@inoway46

@inoway46 inoway46 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

node inspect <script> startup could display the debug> prompt before the initial break output had been rendered.
ex. https://github.com/nodejs/node/actions/runs/28076627608

This updates initial local script startup to wait for the first Debugger.paused render before creating the REPL prompt, preserving the expected startup output order:

Debugger attached.
 ok
Break on start in ...
debug>

This wait only applies to initial local script startup and is released on startup exceptions, client close, or child exit. Other debugger flows are unchanged.

Testing

ninja -C out/Release node
./tools/test.py -p actions parallel/test-debugger-run-restart-init
./tools/test.py -p actions parallel/test-debugger-help
./tools/test.py -p actions sequential/test-debug-prompt
./tools/test.py -p actions parallel/test-debugger-restart-message
./tools/test.py -p actions parallel/test-debugger-exceptions parallel/test-debugger-run-after-quit-restart
VERBOSE=1 out/Release/node test/parallel/test-debugger-auto-resume.mjs

@nodejs-github-bot nodejs-github-bot added debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run. labels Jun 28, 2026
@inoway46
inoway46 marked this pull request as ready for review June 28, 2026 11:16
@inoway46
inoway46 force-pushed the debugger-initial-break-render-wait branch 2 times, most recently from 065ef9a to 7ffd297 Compare June 28, 2026 12:44
Comment on lines +975 to +981
// Startup can fail before the initial pause is reported, so release the
// startup wait instead of blocking the REPL prompt indefinitely.
Runtime.on('exceptionThrown', () => {
if (waitForInitialBreakRender && initialBreakRender) {
finishInitialBreakRenderWait(initialBreakRender);
}
});

@inoway46 inoway46 Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This keeps sequential/test-debug-prompt from hanging when node inspect foo fails before the initial Debugger.paused render and the REPL would otherwise never reach debug>.

failed log: https://github.com/nodejs/node/actions/runs/28320440600/job/83901478505?pr=64189#step:8:6114

@inoway46
inoway46 marked this pull request as draft June 28, 2026 15:06
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
@inoway46
inoway46 force-pushed the debugger-initial-break-render-wait branch from 7ffd297 to 9968df6 Compare June 28, 2026 15:15
@inoway46
inoway46 marked this pull request as ready for review June 28, 2026 15:38
@inoway46

Copy link
Copy Markdown
Contributor Author

The original flake that motivated this PR now appears to be addressed by #65194
This PR still addresses a separate initial-break render ordering gap, but given its limited impact and the additional startup synchronization complexity, I don't think it's worth pursuing at this point.
Closing for now; we can revisit if the ordering issue becomes observable in practice.

@inoway46 inoway46 closed this Aug 18, 2026
@inoway46
inoway46 deleted the debugger-initial-break-render-wait branch August 18, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants