-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
--inspect flag and cluster module - Debug port numbers not incrementing #8201
Comments
That is because the cluster module currently uses You can use |
This commit consolidates the debugging port used by the inspector and Node's legacy debugger. Fixes: nodejs#8201 PR-URL: nodejs#8386 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Some tools are now relying on 9229 to be node.js "inspector" port (I see Chrome extensions, some online blog posts, etc.) Also, having same default port values for old and new protocols may lead to some confusion, e.g. when tools are trying to autodiscover debuggable Node instances. This is a partial revert of 9f1f7e2. This commit preserves the fix for issue #8201 bringing back the behavior that the old and new protocols run on different ports.run on different ports. PR-URL: #8550 Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
This commit adds a test for the debug port value in cluster workers using the inspector debugger. Refs: nodejs#8201 Refs: nodejs#8386 Refs: nodejs#8550 PR-URL: nodejs#8958 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
if you use vs code to debug, you need to specify port and and "autoAttachChildProcesses": true in lanuch.json file. if you debug directly in DevTool ,you need to add a connection to corresponding port that in console. |
When using the
--debug=6000
flag with the cluster module, the first debug port 6000 would be assigned to the cluster master, then the first worker would be assigned to 6001, then the second worker would be assigned to 6002, etc...See https://strongloop.com/strongblog/whats-new-nodejs-v0-12-debugging-clusters/
However, when using the new
--inspect=6000
flag with the cluster module, the cluster master process is assigned 6000 (which is correct) but the first worker is assigned 5859 (instead of the expected 6001), second worker is 5860 (instead of 6002), etc...So this prevents us from changing the default debug ports for workers forked using the cluster module.
I tried messing with the settings on the cluster module by passing custom execArgv options such as:
cluster.setupMaster({execArgv: ["--inspect=6001"]})
(I tried a few variations) but it doesn't appear to work.The text was updated successfully, but these errors were encountered: