Skip to content

debugger: lazily wait for initial break output - #63969

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:test-debugger-run-after-quit-restart-3
Jun 22, 2026
Merged

debugger: lazily wait for initial break output#63969
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:test-debugger-run-after-quit-restart-3

Conversation

@trivikr

@trivikrtrivikr commented Jun 18, 2026

Copy link
Copy Markdown
Member

Fix a flaky test-debugger-run-after-quit-restart failure where the debugger
REPL could display debug> before the initial break output had been rendered.

The startup path now waits for the first local --inspect-brk pause render to
finish before completing REPL startup, but only when that pause render is
observed during startup initialization. This preserves the prompt ordering fix
without hanging when the debug target exits or disconnects before producing an
initial pause event.

Refs:

Error Log
=== release test-debugger-run-after-quit-restart ===
Path: parallel/test-debugger-run-after-quit-restart
Error: --- stderr ---
/Users/runner/work/node/node/dir%20with $unusual"chars?'åß∂ƒ©∆¬…`/test/common/debugger.js:92
const timeoutErr = new Error(`Timeout (${TIMEOUT}) while waiting for ${pattern}`);
^
Error: Timeout (15000) while waiting for /break (?:on start )?in/i
at /Users/runner/work/node/node/dir%20with $unusual"chars?'åß∂ƒ©∆¬…`/test/common/debugger.js:92:28
at new Promise (<anonymous>)
at Object.waitFor (/Users/runner/work/node/node/dir%20with $unusual"chars?'åß∂ƒ©∆¬…`/test/common/debugger.js:67:14)
at Object.waitForInitialBreak (/Users/runner/work/node/node/dir%20with $unusual"chars?'åß∂ƒ©∆¬…`/test/common/debugger.js:116:18)
at Object.<anonymous> (/Users/runner/work/node/node/dir%20with $unusual"chars?'åß∂ƒ©∆¬…`/test/parallel/test-debugger-run-after-quit-restart.js:18:7)
at Module._compile (node:internal/modules/cjs/loader:1947:14)
at Object..js (node:internal/modules/cjs/loader:2087:10)
at Module.load (node:internal/modules/cjs/loader:1669:32)
at Module._load (node:internal/modules/cjs/loader:1450:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:260:19) {
output: '< Debugger listening on ws://127.0.0.1:62970/019e6944-4d82-44b5-956b-e4505af5b290\n' +
'< For help, see: https://nodejs.org/learn/getting-started/debugging\n' +
'< \n' +
'\n' +
'\n' +
'connecting to 127.0.0.1:62970 ...\n' +
'< Debugger attached.\n' +
'< \n' +
'\n' +
' ok\n' +
'\n' +
'debug> '
}

Assisted-by: openai:gpt-5.5

@nodejs-github-botnodejs-github-bot added debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run. labels Jun 18, 2026
@trivikrtrivikr added request-ci Add this label to start a Jenkins CI on a PR. flaky-test Issues and PRs related to the tests with unstable failures on the CI. labels Jun 18, 2026
@trivikr
trivikrforce-pushed the test-debugger-run-after-quit-restart-3 branch from 5f512d0 to 77d19feCompareJune 18, 2026 04:27
@trivikr

This comment was marked as outdated.

@trivikr
trivikr marked this pull request as draft June 18, 2026 16:41
@trivikr
trivikrforce-pushed the test-debugger-run-after-quit-restart-3 branch from 77d19fe to 70ed2a3CompareJune 19, 2026 06:08
@trivikr
trivikr marked this pull request as ready for review June 19, 2026 06:09
@trivikrtrivikr changed the title debugger: wait for initial break outputdebugger: lazily wait for initial break outputJun 19, 2026
Wait for the initial pause render before completing debugger REPL
startup, but only when the initial pause is actually observed during
startup initialization.
Creating the wait promise before Runtime.runIfWaitingForDebugger() can
hang when the debug target exits or disconnects without producing an
initial pause event. It also assumes the inspector object always has
parsed CLI options, which is not true for tests that use a minimal mock
inspector.
Create the initial-render wait lazily from the Debugger.paused handler
while startup initialization is active. This preserves prompt ordering
for normal initial breaks without blocking startup when no initial pause
render occurs.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@trivikr
trivikrforce-pushed the test-debugger-run-after-quit-restart-3 branch from 70ed2a3 to 06bdf2eCompareJune 20, 2026 14:41
@inoway46

Copy link
Copy Markdown
Contributor

This direction looks good to me. It matches the hypothesis in #64005 (comment)

@trivikrtrivikr added the review wanted PRs that need reviews. label Jun 21, 2026
@trivikr
trivikr requested review from aduh95, mcollina and panvaJune 21, 2026 08:00
@trivikrtrivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 21, 2026
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 21, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mcollinamcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 22, 2026
@trivikrtrivikr removed the review wanted PRs that need reviews. label Jun 22, 2026
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 22, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 1f806f2 into nodejs:mainJun 22, 2026
82 of 83 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 1f806f2

aduh95 pushed a commit that referenced this pull request Jun 22, 2026
Wait for the initial pause render before completing debugger REPL
startup, but only when the initial pause is actually observed during
startup initialization.
Creating the wait promise before Runtime.runIfWaitingForDebugger() can
hang when the debug target exits or disconnects without producing an
initial pause event. It also assumes the inspector object always has
parsed CLI options, which is not true for tests that use a minimal mock
inspector.
Create the initial-render wait lazily from the Debugger.paused handler
while startup initialization is active. This preserves prompt ordering
for normal initial breaks without blocking startup when no initial pause
render occurs.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63969
Refs: https://github.com/nodejs/node/actions/runs/27582782593/job/81546582775
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@trivikr
trivikr deleted the test-debugger-run-after-quit-restart-3 branch June 25, 2026 01:17
aduh95 pushed a commit that referenced this pull request Jun 25, 2026
Wait for the initial pause render before completing debugger REPL
startup, but only when the initial pause is actually observed during
startup initialization.
Creating the wait promise before Runtime.runIfWaitingForDebugger() can
hang when the debug target exits or disconnects without producing an
initial pause event. It also assumes the inspector object always has
parsed CLI options, which is not true for tests that use a minimal mock
inspector.
Create the initial-render wait lazily from the Debugger.paused handler
while startup initialization is active. This preserves prompt ordering
for normal initial breaks without blocking startup when no initial pause
render occurs.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63969
Refs: https://github.com/nodejs/node/actions/runs/27582782593/job/81546582775
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Wait for the initial pause render before completing debugger REPL
startup, but only when the initial pause is actually observed during
startup initialization.
Creating the wait promise before Runtime.runIfWaitingForDebugger() can
hang when the debug target exits or disconnects without producing an
initial pause event. It also assumes the inspector object always has
parsed CLI options, which is not true for tests that use a minimal mock
inspector.
Create the initial-render wait lazily from the Debugger.paused handler
while startup initialization is active. This preserves prompt ordering
for normal initial breaks without blocking startup when no initial pause
render occurs.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63969
Refs: https://github.com/nodejs/node/actions/runs/27582782593/job/81546582775
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Wait for the initial pause render before completing debugger REPL
startup, but only when the initial pause is actually observed during
startup initialization.
Creating the wait promise before Runtime.runIfWaitingForDebugger() can
hang when the debug target exits or disconnects without producing an
initial pause event. It also assumes the inspector object always has
parsed CLI options, which is not true for tests that use a minimal mock
inspector.
Create the initial-render wait lazily from the Debugger.paused handler
while startup initialization is active. This preserves prompt ordering
for normal initial breaks without blocking startup when no initial pause
render occurs.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63969
Refs: https://github.com/nodejs/node/actions/runs/27582782593/job/81546582775
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 30, 2026
Wait for the initial pause render before completing debugger REPL
startup, but only when the initial pause is actually observed during
startup initialization.
Creating the wait promise before Runtime.runIfWaitingForDebugger() can
hang when the debug target exits or disconnects without producing an
initial pause event. It also assumes the inspector object always has
parsed CLI options, which is not true for tests that use a minimal mock
inspector.
Create the initial-render wait lazily from the Debugger.paused handler
while startup initialization is active. This preserves prompt ordering
for normal initial breaks without blocking startup when no initial pause
render occurs.
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63969
Refs: https://github.com/nodejs/node/actions/runs/27582782593/job/81546582775
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.debuggerIssues and PRs related to the debugger subsystem.flaky-testIssues and PRs related to the tests with unstable failures on the CI.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@trivikr@inoway46@nodejs-github-bot@mcollina@panva