Skip to content

debugger: wait for target startup before initialization - #64304

Open
Archkon wants to merge 3 commits into
nodejs:mainfrom
Archkon:fixtest
Open

debugger: wait for target startup before initialization#64304
Archkon wants to merge 3 commits into
nodejs:mainfrom
Archkon:fixtest

Conversation

@Archkon

@Archkon Archkon commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Trying to fix the test error that triggered at previous pr when run github action ci/cd

https://github.com/nodejs/node/actions/runs/28730483133/job/85195106458?pr=64301

Fixes: #64116
Fixes: #61762
Fixes: #64005

@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 Jul 5, 2026
@trivikr

trivikr commented Jul 5, 2026

Copy link
Copy Markdown
Member

Several previous attempts of deflaking were unsuccessful.
Please refer #64116 for prior discussions and links to other PRs.

@Archkon

Archkon commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Several previous attempts of deflaking were unsuccessful. Please refer #64116 for prior discussions and links to other PRs.

Ok, I got it .Thanks !

@Archkon
Archkon marked this pull request as draft July 6, 2026 05:26
@Archkon
Archkon force-pushed the fixtest branch 3 times, most recently from 88fe3e7 to 1e6cde7 Compare July 29, 2026 23:48
@Archkon Archkon changed the title debugger: defer pause to avoid pause forever debugger: wait for target startup before initialization Jul 29, 2026
@Archkon
Archkon marked this pull request as ready for review July 29, 2026 23:58
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.49123% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.31%. Comparing base (c18fd90) to head (aa1cfd8).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/debugger/inspect_helpers.js 95.23% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64304      +/-   ##
==========================================
- Coverage   90.31%   90.31%   -0.01%     
==========================================
  Files         759      759              
  Lines      247646   248350     +704     
  Branches    46697    46871     +174     
==========================================
+ Hits       223654   224288     +634     
- Misses      15463    15473      +10     
- Partials     8529     8589      +60     
Files with missing lines Coverage Δ
lib/internal/debugger/inspect_probe.js 82.05% <100.00%> (-0.09%) ⬇️
lib/internal/debugger/inspect_repl.js 91.36% <100.00%> (+0.05%) ⬆️
lib/internal/debugger/inspect_helpers.js 97.00% <95.23%> (-0.41%) ⬇️

... and 40 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.

@Archkon

Archkon commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@joyeecheung @trivikr Could you take a look at this? I believe this would fix the flaky tests that related to timou of macos ci

@avivkeller
avivkeller requested review from joyeecheung and trivikr and removed request for joyeecheung August 5, 2026 02:05
@Archkon

Archkon commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@joyeecheung @trivikr Please take a look at this

@joyeecheung

Copy link
Copy Markdown
Member

I think at the minimum the commit should explain why the previous flakes happen, and why the change is supposed to fix it?

Archkon added 3 commits August 6, 2026 23:15
The debugger endpoint can accept a connection before the target has
entered its startup wait. In that window,Runtime.runIfWaitingForDebugger
may be handled too early, leaving the target waiting indefinitely.

Use NodeRuntime.waitingForDebugger as a readiness handshake before
initializing the debugger domains and releasing the target. Apply the
handshake to both the interactive debugger and probe mode,and reject the
wait if the session closes.

Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com>
Debugger tests spawn a debugger client and target process, then wait for
asynchronous CLI output through a shared test helper.Under high parallel
load on macOS, process scheduling and inspector communication can delay
progress beyond the existing 15-second timeout, causing intermittent
failures across multiple debugger tests.

Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com>
Run the debugger CLI in the per-test temporary directory so concurrent
runs do not overwrite or remove the same node.cpuprofile file.

Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com>
@Archkon

Archkon commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@joyeecheung I have tried stress test for all test/parallel/test-debugger-*x1000 with -j 16 and all passed
You could refer to
https://github.com/Archkon/node/actions/runs/30611428496/job/91094848364
https://github.com/Archkon/node/actions/runs/30611440979/job/91094888598
https://github.com/Archkon/node/actions/runs/30611450116/job/91094920610

And also select one of flaky tests to run 1 million times to check and before github aciton timeout no one would fail
https://github.com/Archkon/node/actions/runs/30514960670/job/90782618615

@Archkon
Archkon force-pushed the fixtest branch 2 times, most recently from b85de2c to aa1cfd8 Compare August 7, 2026 04:08
@Archkon

Archkon commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

I revert the two commit that fix the flaky test and you could see the parallel/test-debugger-exceptions would fail from time to time but this never fail at the previously stress test of 1 million times.

Refs: https://github.com/Archkon/node/actions/runs/31153457092/job/92787764799

And you could download the diagostic infomation from artificat that I used to ix the timeout problem of all test-debugger-* tests on macos platform to review and inspect

Refs: https://github.com/Archkon/node/actions/runs/31155360956/job/92793569004
Artifact download URL: https://github.com/Archkon/node/actions/runs/31155360956/artifacts/8985497905

You could see log like this for the race condtion of failed tests

... omitted ...

{"seq":753,"t":1145051576583,"pid":88080,"event":"channel.dispatch.received","session":-1,"bytes":51,"value":0,"id":4,"method":"Runtime.runIfWaitingForDebugger"}
{"seq":754,"t":1145051578791,"pid":88080,"event":"channel.dispatch.v8","session":-1,"bytes":51,"value":0,"id":4,"method":"Runtime.runIfWaitingForDebugger"}
{"seq":755,"t":1145051591291,"pid":88080,"event":"channel.waiting.unset","session":-1,"bytes":0,"value":0,"id":-1}

... omitted ...

{"seq":771,"t":1145051717166,"pid":88080,"event":"channel.waiting.set","session":-1,"bytes":0,"value":0,"id":-1}
{"seq":772,"t":1145051717416,"pid":88080,"event":"main.wait_frontend.begin","session":-1,"bytes":0,"value":0,"id":-1}

@joyeecheung Please evaluate this

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

4 participants