Skip to content

debugger: lazily wait for initial break output#63969

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-debugger-run-after-quit-restart-3
Open

debugger: lazily wait for initial break output#63969
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-debugger-run-after-quit-restart-3

Conversation

@trivikr

@trivikr trivikr 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-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 18, 2026
@trivikr trivikr 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 trivikr force-pushed the test-debugger-run-after-quit-restart-3 branch from 5f512d0 to 77d19fe Compare June 18, 2026 04:27
@trivikr

trivikr commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

Marked as draft as there are many CI to failures.

@trivikr trivikr marked this pull request as draft June 18, 2026 16:41
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 trivikr force-pushed the test-debugger-run-after-quit-restart-3 branch from 77d19fe to 70ed2a3 Compare June 19, 2026 06:08
@trivikr trivikr marked this pull request as ready for review June 19, 2026 06:09
@trivikr trivikr changed the title debugger: wait for initial break output debugger: lazily wait for initial break output Jun 19, 2026
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. flaky-test Issues and PRs related to the tests with unstable failures on the CI. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants