-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Node process with --inspect cannot fork child process without passing --inspect #14325
Comments
Test case? I think I know what you mean but I'd rather not guess and guess wrong. |
This is caused by the default inspector port being taken up by the inspector. I can see exactly same behavior when running Node 6.11 with --debug. This issue can be avoided by running Node with port 0 (--inspect=0). Should there be some special handling for --inspect? |
If the |
@bnoordhuis Yeah, sorry about that rushed report, I'm trying to make a small repro case asap. @eugeneo That was my first suspect, but @gibfahn is right, the actual case is that |
What @eugeneo is saying is that if you pass Still not sure why the inspector is enabled for the forked process. |
Here is the repro script: https://gist.github.com/unbornchikken/298b6c507cea82a81074b801271f15d6 node repro will run fine, however node --inspect repro will result with: $ node --inspect repro.js
Debugger listening on ws://127.0.0.1:9229/cea75bbb-107e-470e-882d-644d46241e43
For help see https://nodejs.org/en/docs/inspector
Parent started.
Starting inspector on 127.0.0.1:9229 failed: address already in use
Forked child exit, code: 12
Forked child close. It seems fork secretly pass an --inspect argument, but I don't belive that is an expected behavior, because it will never work this way, because parent is always holding the default inspect port in this case. Being explicit with the inspect port will result: $ node --inspect=55555 repro.js
Debugger listening on ws://127.0.0.1:55555/ed7f4b59-67f7-4737-86db-16aacf4f5546
For help see https://nodejs.org/en/docs/inspector
Parent started.
Starting inspector on 127.0.0.1:55555 failed: address already in use
Forked child exit, code: 12
Forked child close. Again, the inspect argument got passed as is. But it should never work that way, because parent has been holding this for sure. |
There's no secret: child_process.fork() accepts a .execArgv option that defaults to process.execArgv when omitted. |
@bnoordhuis The problem is that I had no issue of this kind with Node.js 4 |
Seems related to #9435 |
The main reason is that |
If I start a node process with --inspect and fork a child node process without passing --inspect, child process will crash with exit code of 12.
Is this the intended behavior?
Edit: added a repro case there #14325 (comment)
The text was updated successfully, but these errors were encountered: