Repository navigation
inspector: support attaching to a running process in probe mode - #67201
Open
joyeecheung wants to merge 1 commit into
Open
joyeecheung wants to merge 1 commit into
joyeecheung wants to merge 1 commit into
Conversation
joyeecheung
force-pushed
the
probe-attach-7
branch
from
November 2, 2026 14:55
5b94c46 to
db767cb
Compare
Collaborator
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67201 +/- ##
==========================================
+ Coverage 90.65% 90.71% +0.05%
==========================================
Files 797 797
Lines 278780 279168 +388
Branches 53611 53704 +93
==========================================
+ Hits 252739 253242 +503
+ Misses 16385 16291 -94
+ Partials 9656 9635 -21
🚀 New features to boost your workflow:
|
Probe mode currently only launches a new process from the entry point script. This change lets it attach to an already-running process, so a long-lived application can be inspected without restarting it. Running `node inspect --probe` without specifying an entry point script instructs Node.js to attach to a running Node.js process and probe. The way attaching is done is specified through command line arguments: - `--pid <pid>` activates the target's inspector (if it's not already activated) and connects to it. - `--host <host>` and `--port <port>` specify an address where an inspector is listening. The host defaults to 127.0.0.1 and the port defaults to 9229. When the session ends, probe mode resumes and detaches instead of killing a process it does not own. The report now includes a top-level `target` field describing what was probed, and each probe contains a `locations` field about where it bound. An attach session ends when a probe reaches `--max-hit` (reported as `completed`), when the target finishes on its own (`completed`, or `miss` with the pending probes, and the target is then allowed to exit), or when `--timeout` fires (reported as `timeout`, the probing process exit with 0 and reports the hits recorded so far). `--timeout` now is also applied to the startup phase in both modes, so a target that never responds before the breakpoints are bound is reported as an error instead of hanging. Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
joyeecheung
force-pushed
the
probe-attach-7
branch
from
November 3, 2026 17:13
db767cb to
c2881e9
Compare
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Probe mode currently only launches a new process from the entry point script. This change lets it attach to an already-running process, so a long-lived application can be inspected without restarting it.
Running
node inspect --probewithout specifying an entry point script instructs Node.js to attach to a running Node.js process and probe. The way attaching is done is specified through command line arguments:--pid <pid>activates the target's inspector (if it's not already activated) and connects to it.--host <host>and--port <port>specify an address where an inspector is listening. The host defaults to 127.0.0.1 and the port defaults to 9229.When the session ends, probe mode resumes and detaches instead of killing a process it does not own. The report now includes a top-level
targetfield describing what was probed, and each probe contains alocationsfield about where it bound.An attach session ends when a probe reaches
--max-hit(reported ascompleted), when the target finishes on its own (completed, ormisswith the pending probes, and the target is then allowed to exit), or when--timeoutfires (reported astimeout, the probing process exit with 0 and reports the hits recorded so far).--timeoutnow is also applied to the startup phase in both modes, so a target that never responds before the breakpoints are bound is reported as an error instead of hanging.