-
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
cluster: fixing debug port logic for forking workers #9659
cluster: fixing debug port logic for forking workers #9659
Conversation
|
||
console.log('forked worker should have --debug-port, with offset = 2'); | ||
console.log('debugging with --debug=[ipv6addr]:port format should also work'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this test only be executed if ipv6 is available (e.g. common.hasIPv6
), otherwise it's skipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it common to test against systems without ipv6 enabled on interface? (c'mon, it's 2016)
But if other ipv6-related tests do check ipv6 availability, these should do it indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there are ipv6-only tests that bail immediately if it's not available. Besides, it's easy enough to support with just an added conditional.
}).on('exit', checkExitCode); | ||
|
||
console.log('debugging with --debug=ipv4addr:port format should also work'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the console.log()
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log()
's were in original test file. I've continued to use them.
I'll use js comments like other test files do.
Thanks for pointing out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but I think in general when new tests are added or old tests are edited, these kinds of unnecessary outputs are being removed. I can't remember if it was @Trott or someone else who had brought this up before. I think comments are better.
'forked worker should have debugPort, with offset = 1'); | ||
cluster.fork({ | ||
portSet: process.debugPort + 1 | ||
}).on('exit', checkExitCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be best to wrap all references to checkExitCode
with common.mustCall()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mscdex common.mustCall()
on an exit handler won't work reliably as common.mustCall()
relies on an exit handler itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops! Ignore me! It won't work reliably on an exit
handler on process
but should be fine on child_process (I think).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it just like this?
cluster.fork({
portSet: process.debugPort + 1
}).on('exit', common.mustCall(checkExitCode));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, like that.
|
||
cluster.fork({ | ||
portSet: 13000 + 2 | ||
}).on('exit', checkExitCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto about wrapping checkExitCode
.
portSet: 13000 | ||
}).on('exit', checkExitCode); | ||
|
||
console.log('when using custom port number, ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto about console.log()
statements.
7eea3df
to
d1e7e3d
Compare
@mscdex there, i fixed it |
Looks like there's a relevant failure:
|
d1e7e3d
to
19c0339
Compare
I've changed the way to distinguish master and worker before requiring |
https://ci.nodejs.org/job/node-test-commit-plinux/nodes=ppcbe-ubuntu1404/5200/console this fail looks strange. Could you ru-run that specific job? |
@mutantcornholio I wouldn't worry about those two failures, they are CI infrastructure-related. The new changes pass on the previously problematic config (linux-fips). |
Could you please review commit message and check the checkbox if everything is okay? |
Any news about the PR? |
@Fishrock123 @mscdex c'mon, guys, it was a week of silence |
@mutantcornholio First line of the commit message should be <= 50 characters |
/cc @nodejs/collaborators |
19c0339
to
9e7c8d0
Compare
@mscdex fixed |
I think handling of |
@@ -1,42 +1,72 @@ | |||
'use strict'; | |||
require('../common'); | |||
|
|||
// this is hack to make master process think it is running with --debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you capitalize and punctuate comments please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not good with english punctuation, but I've tried my best
38ff472
to
0865869
Compare
@cjihrig makes sense. Done. |
Guys, I'm getting tired of this. I want this scenario: When we were at 0.10, we used to set After upgrading to 6.9, this broke. I found two bugs: So I've bypassed the incrementing port logic by setting I wouldn't dare to commit THAT to our clustering system, so i've commit it right to our node_modules (it's vendored), and I'm recommiting this every time we're updating our clustering system. With all that stuff we've talked about over the half a year, I want to do this:
If no one objects, i'll start working on it tomorrow @refack @sam-github @bnoordhuis @Trott @gibfahn @cjihrig @thefourtheye @jasnell @mscdex |
@mutantcornholio I appreciate your dedication, and am sorry for the delay and contradictory back and forth. |
No, but (3) does =)
I would like to fix (2) myself. I've already did the research, ready to code and want to be a useful member of node.js community! |
You're my new hero 💂 |
#13619 here we go |
Instead of parsing execArgv, just adding --inspect-port with whatever debug port should be. Also exporting initial debug options to `process._debugOptions`, but needed it only in tests for now. parallel/test-cluster-inspector-debug-port.js deleted in favor of inspector/test-inspector-port-cluster.js Refs: nodejs#9659 (comment)
* Adding --inspect-port with debug port, instead of parsing `execArgv` * Export CLI debug options to `process.binding('config').debugOptions` (currently used only in tests) PR-URL: nodejs#13619 Refs: nodejs#9659 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Adding --inspect-port with debug port, instead of parsing `execArgv` * Export CLI debug options to `process.binding('config').debugOptions` (currently used only in tests) PR-URL: #13619 Refs: #9659 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Adding --inspect-port with debug port, instead of parsing `execArgv` * Export CLI debug options to `process.binding('config').debugOptions` (currently used only in tests) PR-URL: #13619 Refs: #9659 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Capitalization and punctuation. * `setupMaster` contained info about `settings` which where incomplete. PR-URL: nodejs#14140 Fixes: nodejs#8495 Fixes: nodejs#12941 Refs: nodejs#9659 Refs: nodejs#13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
10 ports for each test-case is too much. Not enough ports for new test cases, considering ~100 ports per file. PR-URL: nodejs#14140 Fixes: nodejs#8495 Fixes: nodejs#12941 Refs: nodejs#9659 Refs: nodejs#13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Added an option to override inspector port for workers using `settings.inspectPort` will override default port incrementing behavior. Also, using this option allows to set 0 port for the whole cluster. PR-URL: nodejs#14140 Fixes: nodejs#8495 Fixes: nodejs#12941 Refs: nodejs#9659 Refs: nodejs#13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Capitalization and punctuation. * `setupMaster` contained info about `settings` which where incomplete. PR-URL: #14140 Fixes: #8495 Fixes: #12941 Refs: #9659 Refs: #13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
10 ports for each test-case is too much. Not enough ports for new test cases, considering ~100 ports per file. PR-URL: #14140 Fixes: #8495 Fixes: #12941 Refs: #9659 Refs: #13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Added an option to override inspector port for workers using `settings.inspectPort` will override default port incrementing behavior. Also, using this option allows to set 0 port for the whole cluster. PR-URL: #14140 Fixes: #8495 Fixes: #12941 Refs: #9659 Refs: #13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Capitalization and punctuation. * `setupMaster` contained info about `settings` which where incomplete. PR-URL: #14140 Fixes: #8495 Fixes: #12941 Refs: #9659 Refs: #13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
10 ports for each test-case is too much. Not enough ports for new test cases, considering ~100 ports per file. PR-URL: #14140 Fixes: #8495 Fixes: #12941 Refs: #9659 Refs: #13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Added an option to override inspector port for workers using `settings.inspectPort` will override default port incrementing behavior. Also, using this option allows to set 0 port for the whole cluster. PR-URL: #14140 Fixes: #8495 Fixes: #12941 Refs: #9659 Refs: #13761 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
Description of change
An attempt to fix #8495 and #9435
You can set debug ports for workers in cluster with
cluster.settings.execArgv
hacking once again!The problem is, at current version, debug port for workers calculated from master's
process.debugPort
, but a lot of software usescluster.settings
which is being ignored.After this changes, if you set a port in
cluster.settings.execArgv
and not starting master with debug, port offset would be added to port incluster.settings.execArgv
.Debug port autoincrement logic seems to be preserved.
The other issue is, debug argument format evolved and current regex does not cover all the cases that node accepts. Parsing it with one regex is too hard now, so I had to write some js to do it.
Also, current logic changes every debug argument, while changing only last one is sufficient.