Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: API for debugging node child processes #9621

Closed
mightyiam opened this issue Nov 15, 2016 · 10 comments
Closed

Feature request: API for debugging node child processes #9621

mightyiam opened this issue Nov 15, 2016 · 10 comments
Labels
feature request Issues that request new features to be added to Node.js. inspector Issues and PRs related to the V8 inspector protocol

Comments

@mightyiam
Copy link
Contributor

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_process for this purpose.

What I request is an API that will solve this.

Here’s a thought: An addition to the debugging protocol that:

  1. Informs the debugger that a new node child process is going to be launched
    1. Allows the debugger to decide whether that process will be debuggable
      1. If true, the debug port will be provided to the debugger and the debugger could launch a new instance of itself on that.
@mscdex mscdex added debugger feature request Issues that request new features to be added to Node.js. labels Nov 15, 2016
@eugeneo eugeneo added the inspector Issues and PRs related to the V8 inspector protocol label Nov 15, 2016
@eugeneo
Copy link
Contributor

eugeneo commented 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.

@eugeneo
Copy link
Contributor

eugeneo commented Nov 15, 2016

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.

@eugeneo
Copy link
Contributor

eugeneo commented Nov 16, 2016

This PR is beginning the process of decoupling the HTTP transport: #9630

@develar
Copy link

develar commented Nov 16, 2016

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

@develar
Copy link

develar commented Nov 16, 2016

I have filed avajs/ava#1110

@Trott
Copy link
Member

Trott commented Jul 15, 2017

Should this remain open?

@bnoordhuis
Copy link
Member

I'll close this out, the necessary work in node.js has been done, as far as I can tell.

@jaridmargolin
Copy link

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

@bnoordhuis
Copy link
Member

@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.)

@medikoo
Copy link

medikoo commented Jul 18, 2017

Seems related to #9435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

No branches or pull requests

8 participants