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

Cannot attach to second node process by using SIGUSR1 #18639

Closed
aldafu opened this issue Feb 8, 2018 · 4 comments
Closed

Cannot attach to second node process by using SIGUSR1 #18639

aldafu opened this issue Feb 8, 2018 · 4 comments
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. inspector Issues and PRs related to the V8 inspector protocol

Comments

@aldafu
Copy link

aldafu commented Feb 8, 2018

  • Version: 6.12.3 +
  • Platform: Win 10 x64 / Linux 4.x
  • Subsystem:

Suppose I have two or more running node processes which are not in debugging mode and I want to activate the debugger in these processes. By using SIGUSR1 or process._debugProcess() the process starts listening on the default port 5858 for the debugging client. All node processes after the first that receive SIGUSR1 will fail to take port 5858 and thus cannot be debugged while already running.

Worse, if you use node debug -p $PID_OF_SECOND_PROCESS the debugger will attach to the first node process that was able to take port 5858 instead of the PID given on the command-line.

Is there any way to change the default debugging port for an already running node process, so I can attach to that?

@bnoordhuis bnoordhuis added doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. inspector Issues and PRs related to the V8 inspector protocol labels Feb 9, 2018
@bnoordhuis
Copy link
Member

Start node with --inspect-port=0 to bind to a random port or set process.debugPort to the desired port number.

process.debugPort should be documented. I've added labels. Could use a note in doc/api/process.md and doc/api/debugger.md.

@juggernaut451
Copy link
Contributor

juggernaut451 commented Feb 10, 2018

can i take this up @bnoordhuis ?
It would be my first contribution

@aldafu
Copy link
Author

aldafu commented Feb 12, 2018

This is about already running processes, so I don't think --inspect-port=0 or process.debugPort are valid options, right? How configure that port once the process is already running?

@bnoordhuis
Copy link
Member

As long as the inspector hasn't been started yet, you can configure the port with process.debugPort.

addaleax pushed a commit to addaleax/node that referenced this issue Feb 26, 2018
Fixes: nodejs#18639

PR-URL: nodejs#18716
Refs: nodejs#18639
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
addaleax pushed a commit that referenced this issue Feb 26, 2018
Fixes: #18639

PR-URL: #18716
Refs: #18639
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
Fixes: nodejs#18639

PR-URL: nodejs#18716
Refs: nodejs#18639
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
jasnell pushed a commit to jasnell/node that referenced this issue Aug 17, 2018
Fixes: nodejs#18639

PR-URL: nodejs#18716
Refs: nodejs#18639
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this issue Sep 6, 2018
Fixes: #18639

Backport-PR-URL: #22380
PR-URL: #18716
Refs: #18639
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
abhishekumar-tyagi pushed a commit to abhishekumar-tyagi/node that referenced this issue May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

No branches or pull requests

3 participants