debugger: await initialization after run and restart by trivikr · Pull Request #63607 · nodejs/node · GitHub
Skip to content

debugger: await initialization after run and restart#63607

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
trivikr:test-debugger-run-after-quit-restart
Jun 15, 2026
Merged

debugger: await initialization after run and restart#63607
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
trivikr:test-debugger-run-after-quit-restart

Conversation

@trivikr

@trivikr trivikr commented May 28, 2026

Copy link
Copy Markdown
Member

Fix a debugger CLI synchronization race after run and restart.

Previously, these commands resolved once the inspector websocket connection
was established and ok was printed. The debugger initialization that enables
domains, restores breakpoints, and calls Runtime.runIfWaitingForDebugger()
was started from the ready event but not awaited.

That allowed the REPL prompt to be displayed before the restarted debuggee had
actually been released from --inspect-brk and reported the initial break. In
slow CI runs, this could make parallel/test-debugger-run-after-quit-restart
time out while waiting for the initial break message.

This changes run and restart to await the same post-connect initialization
path before resolving.

Observed in:

Error Log
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 /Users/runner/work/node/node/dir%20with $unusual"chars?'åß∂ƒ©∆¬…`/test/parallel/test-debugger-run-after-quit-restart.js:46:21
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5) {
  output: '< Debugger listening on ws://127.0.0.1:62843/a2167dba-9191-46bd-8b81-4245173caea4\n' +
    '< For help, see: [https://nodejs.org/learn/getting-started/debugging\n](https://nodejs.org/learn/getting-started/debugging/n)' +
    '< \n' +
    '\n' +
    'debug> connecting to 127.0.0.1:62843 ...\n' +
    '\n' +
    '< Debugger attached.\n' +
    '< \n' +
    '\n' +
    'debug> \n' +
    ' ok\n' +
    'debug> '
}

Refs: #61762


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 May 28, 2026
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2026
@trivikr trivikr force-pushed the test-debugger-run-after-quit-restart branch from 30e43c1 to abdc88b Compare June 9, 2026 01:55
@trivikr trivikr added flaky-test Issues and PRs related to the tests with unstable failures on the CI. review wanted PRs that need reviews. labels Jun 10, 2026
trivikr added 2 commits June 14, 2026 22:42
Ensure the debugger CLI waits for post-connect initialization before
resolving the run and restart commands. This prevents tests and users
from observing a prompt before Runtime.runIfWaitingForDebugger() has
released the new debuggee.

Refs: nodejs#61762

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 branch from abdc88b to 2824aec Compare June 15, 2026 05:42
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 15, 2026
@nodejs-github-bot

This comment was marked as outdated.

@trivikr trivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 15, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikr trivikr added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed review wanted PRs that need reviews. labels Jun 15, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 15, 2026
@nodejs-github-bot nodejs-github-bot merged commit c2f2013 into nodejs:main Jun 15, 2026
73 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in c2f2013

@trivikr trivikr deleted the test-debugger-run-after-quit-restart branch June 15, 2026 20:07
aduh95 pushed a commit that referenced this pull request Jun 18, 2026
Ensure the debugger CLI waits for post-connect initialization before
resolving the run and restart commands. This prevents tests and users
from observing a prompt before Runtime.runIfWaitingForDebugger() has
released the new debuggee.

Refs: #61762

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63607
Refs: #61762
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
@trivikr

trivikr commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

luanmuniz pushed a commit to luanmuniz/node that referenced this pull request Jun 25, 2026
Ensure the debugger CLI waits for post-connect initialization before
resolving the run and restart commands. This prevents tests and users
from observing a prompt before Runtime.runIfWaitingForDebugger() has
released the new debuggee.

Refs: nodejs#61762

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: nodejs#63607
Refs: nodejs#61762
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
aduh95 pushed a commit that referenced this pull request Jun 25, 2026
Ensure the debugger CLI waits for post-connect initialization before
resolving the run and restart commands. This prevents tests and users
from observing a prompt before Runtime.runIfWaitingForDebugger() has
released the new debuggee.

Refs: #61762

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63607
Refs: #61762
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants