镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Feature request: API for debugging node child processes #9621

Description

@mightyiam

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.

Activity

  1. added
    inspectorIssues and PRs related to the V8 inspector protocol.
    on Nov 15, 2016
  2. eugeneo commented on Nov 15, 2016

    @eugeneo
    Contributor

    Our team is currently investigating this, it was part of the rationale for the Node inspector agent refactoring that is currently being worked on.

  3. eugeneo commented on Nov 15, 2016

    @eugeneo
    Contributor

    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.

  4. eugeneo commented on Nov 16, 2016

    @eugeneo
    Contributor

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

  5. develar commented on Nov 16, 2016

    @develar

    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

  6. develar commented on Nov 16, 2016

    @develar

    I have filed avajs/ava#1110

  7. Trott commented on Jul 15, 2017

    @Trott
    Member

    Should this remain open?

  8. bnoordhuis commented on Jul 17, 2017

    @bnoordhuis
    Member

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

  9. jaridmargolin commented on Jul 17, 2017

    @jaridmargolin

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

  10. bnoordhuis commented on Jul 17, 2017

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

  11. medikoo commented on Jul 18, 2017

    @medikoo

    Seems related to #9435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.inspectorIssues and PRs related to the V8 inspector protocol.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions