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

@trivikrtrivikr 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-restartError: --- 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-botnodejs-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

codecovBot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (4639dcb) to head (30e43c1).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #63607 +/- ##
==========================================
+ Coverage 90.29% 90.32% +0.02% 
==========================================
Files 730 730 Lines 234695 234709 +14 Branches 43956 43963 +7 ==========================================
+ Hits 211927 211993 +66 + Misses 14494 14434 -60 - Partials 8274 8282 +8 
Files with missing linesCoverage Δ
lib/internal/debugger/inspect_repl.js91.78% <100.00%> (+0.01%)⬆️

... and 53 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trivikrtrivikr added the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2026
@trivikr
trivikrforce-pushed the test-debugger-run-after-quit-restart branch from 30e43c1 to abdc88bCompareJune 9, 2026 01:55
@trivikrtrivikr 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
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
trivikrforce-pushed the test-debugger-run-after-quit-restart branch from abdc88b to 2824aecCompareJune 15, 2026 05:42
@github-actionsgithub-actionsBot 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.

@trivikrtrivikr 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

@trivikrtrivikr 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-botnodejs-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:mainJun 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
MemberAuthor

This change did not help, as test-debugger-run-after-quit-restart continues to fail as reported in #64005

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>
aduh95 pushed a commit that referenced this pull request Jul 22, 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>
aduh95 pushed a commit that referenced this pull request Jul 30, 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 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.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.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.

3 participants

@trivikr@nodejs-github-bot@watilde