Repository navigation
Feature request: API for debugging node child processes #9621
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Nov 15, 2016 - addedinspectorIssues and PRs related to the V8 inspector protocol.Issues and PRs related to the V8 inspector protocol.
on Nov 15, 2016 Our team is currently investigating this, it was part of the rationale for the Node inspector agent refactoring that is currently being worked on.
One of the experiments is available here - https://github.com/eugeneo/node-restarter - it allows using Ctrl+R keybinding from the Chrome devtools debugger to restart the Node process (other frontends likely have some way of "reloading" as well).
Note that the restarter script currently needs patched Node, we are looking into bringing the code into the main line.
This PR is beginning the process of decoupling the HTTP transport: #9630
For example, debugging any test that's run with my favorite test runner, https://github.com/avajs/ava, is kind of impossible, because all of the tests run in child processes and there's no feature to allow running tests in the main process.
It is already fixed and you can use or IDEA/Webstorm, or node inspector to debug tests. Please see https://github.com/avajs/ava/blob/master/docs/recipes/debugging-with-webstorm.md and avajs/ava#874
I have filed avajs/ava#1110
Should this remain open?
I'll close this out, the necessary work in node.js has been done, as far as I can tell.
@bnoordhuis - could you please link to PR, commits, or docs in regards to:
the necessary work in node.js has been done, as far as I can tell.
@jaridmargolin #13619 and #14140 for the cluster module, the inspector saw several upgrades, and there has been discussion on extending the cluster fixes to the child_process module.
(I had a hard time finding back that last issue though. It's.. somewhere in the bug tracker.)
Seems related to #9435
Kind-of-recent changes in the debugging feature make it easy to debug a node process with whatever debugger speaks the protocol. Most notable, perhaps, is Chrome DevTools.
Further, a wrapper tool makes it trivial to start a node process with debugging on and launch the debugger on that. An example that I'm using is https://github.com/jaridmargolin/inspect-process.
For me, experience is smooth and I'm happy until I reach the great wall of the child process. For example, debugging any test that's run with my favorite test runner, https://github.com/avajs/ava, is kind of impossible, because all of the tests run in child processes and there's no feature to allow running tests in the main process.
inspect-process is considering monkey-patching methods of
child_processfor this purpose.What I request is an API that will solve this.
Here’s a thought: An addition to the debugging protocol that: