Skip to content

Listening to SIGUSR1 blocks debugger #19619

Description

@mlucool
  • Version: v8.9.4
  • Platform: 3.10.0-693.17.1.el7.x86_64

I am not sure which is the correct behavior for an intercepted SIGUSR1, the documentation or the a test case. Can the code and/or documentation please be fixed?

process documentation says:

SIGUSR1 is reserved by Node.js to start the debugger. It's possible to install a listener but doing so will not stop the debugger from starting.

But a quick test shows that the debugger is not started.

Code:

let i = 0;
setInterval(() =>
        console.log(i++),
    1000);

process.on('SIGUSR1', () => console.log('Got SIGUSR1'))

If you send a SIGUSR1 only Got SIGUSR1 is printed. The typical Debugger listening on ws://127.0.0.1:9229/66fb119d-2443-4bdf-80b1-6386995ba253 is not printed. You can also verify that the debugger didn't start with with netstat -ap.

Activity

  1. targos commented on Mar 26, 2018

    @targos
    Member

    @nodejs/v8-inspector

  2. added
    inspectorIssues and PRs related to the V8 inspector protocol.
    on Mar 26, 2018
  3. bnoordhuis commented on Mar 27, 2018

    @bnoordhuis
    Member

    It depends on when the inspector is started. If it's activated at startup, then the JS code will override it. If it's activated later, it subsumes the JS listener.

    I think right now it's always started early (require('inspector').open() uses a different mechanism) but it hasn't always been that way and it could change again in the future.

    I'd use guarded language: "It's possible to install a listener but doing so might interfere with the debugger."

  4. added
    docIssues and PRs related to Node.js documentation.
    good first issueIssues that are suitable for first-time contributors.
    on Mar 27, 2018
  5. willhayslett commented on Mar 30, 2018

    @willhayslett
    Contributor

    @bnoordhuis please let me know if the changes are okay or if additional edits are needed. Thanks.

  6. mlucool commented on Apr 2, 2018

    @mlucool
    Author

    @bnoordhuis Do you expect this to always work/enable me to set the port at runtime?

    process.on('SIGUSR1', () => {
        const port = myPortFinder();
        require('inspector').open(port);
    });
    
  7. added a commit that references this issue on Apr 3, 2018
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

    docIssues and PRs related to Node.js documentation.good first issueIssues that are suitable for first-time contributors.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