-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Impossible to debug multi-threaded processes on headless server. #16469
Comments
Can you fill out the issue template? We ask it for a reason.
Follow inspector development in upstream Chromium. We're a downstream consumer. |
v8.7.0, |
Thanks. That MacBook probably isn't the machine you're having trouble with though, is it? Can you post the exact steps you use to start node.js + connect to it? The snippet you posted seems to be a script executing. It hides the actual invocations. |
No, though I verified that I can cause the problem on my mac. It's not platform-specific. I forgot I posted the script. The actual invokation inside the script is the one I posted: `node inspect --inspect-port 0 ./script.js Bizarrely just twice, in circumstances I don't really understand I also just figured out that it is possible to debug it. Node inspect can be used as a client when given a host and port combination, which works when I background the result of --inspect-brk=0. Perhaps the easiest fix would be simply updating the documentation, but it would be nice if there was a way to run inspect and get the debugger on that process, without port conflicts, as I've suggested here. |
Couple of things:
I opened nodejs/node-inspect#51 to make binding to port zero work more smoothly. |
You're right of course about =, that was a typo here. I just tried putting the argument before inspect. You're quite correct that it does do something different than putting the argument after:
vs
|
Ah, but I see your diff fixes that, awesome! |
Selecting port zero makes the inspector bind to a random port. The inspector prints the URL it listens on to stderr. Parse the output from the child process to find the port number. This commit coincidentally also makes `node inspect --port=0 x.js` work and a regression test to that effect has been added. Note that connecting to an existing process that listens on a non-standard port with `node inspect -p <pid>` does not work because then we never see the output from the inspector. Fixes: nodejs/node#16469
See closed issue #9435
and
#5025
While it is possible now to run node --inspect-brk=0, this only waits for a GUI to connect to the debugger. In my case a restrictive network configuration means that I can't actually connect a GUI debugger to a completely random port.
Thus my circumstances dictate that I need to use the CLI debugger with a random port. I would assume that the command to run would be
Expected:
node inspect --inspect-port 0
launches the CLI debugger in the main thread, and the background thread does not crash with port 9229 in use errors.Actual:
In other news I'd love to know where we could track progress towards being able to debug multiple child processes over a single port.
The text was updated successfully, but these errors were encountered: