-
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: fix inspector port assignment #18696
Conversation
lib/internal/cluster/master.js
Outdated
@@ -119,6 +119,9 @@ function createWorkerProcess(id, env) { | |||
} | |||
} else { | |||
inspectPort = process.debugPort + debugPortOffset; | |||
const offset = inspectPort - 65535; | |||
if (offset > 0) | |||
inspectPort = 1023 + offset; |
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 would have written this as:
const [minPort, maxPort] = [1024, 65535];
…
if (inspectPort > maxPort)
inspectPort = inpectPort - maxPort + minPort - 1;
Not sure if others agree with me, though, so lets wait for further comments ;-)
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.
@ChALkeR looks a little bit more readable :)
@santigimeno hi! You have a little typo in the title "inpector" -> "inspector" |
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.
LGTM with nits addressed.
assert.strictEqual(ports[0] + 1, ports[1]); | ||
assert.strictEqual(ports[1] + 1, ports[2]); | ||
assert.strictEqual(ports[2] + 1, ports[3]); | ||
ports.forEach((port, i) => { |
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 think I'd prefer to keep the existing assertion style instead of using a forEach()
. It's much more readable IMO.
6ce83ac
to
1af082e
Compare
Make sure that inspector ports in cluster are inside the valid range: `[1024, 65535]`. Fix flaky `test-inspector-port-zero-cluster`. Fixes: nodejs#18303
1af082e
to
efdea32
Compare
Comments addressed. CI: https://ci.nodejs.org/job/node-test-pull-request/13249/ |
Landed in 45982de 🎉 |
Make sure that inspector ports in cluster are inside the valid range: `[1024, 65535]`. Fixes flaky `test-inspector-port-zero-cluster`. PR-URL: nodejs#18696 Fixes: nodejs#18303 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Make sure that inspector ports in cluster are inside the valid range: `[1024, 65535]`. Fixes flaky `test-inspector-port-zero-cluster`. PR-URL: nodejs#18696 Fixes: nodejs#18303 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Make sure that inspector ports in cluster are inside the valid range: `[1024, 65535]`. Fixes flaky `test-inspector-port-zero-cluster`. PR-URL: #18696 Fixes: #18303 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Make sure that inspector ports in cluster are inside the valid range: `[1024, 65535]`. Fixes flaky `test-inspector-port-zero-cluster`. PR-URL: #18696 Fixes: #18303 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Make sure that inspector ports in cluster are inside the valid range: `[1024, 65535]`. Fixes flaky `test-inspector-port-zero-cluster`. PR-URL: nodejs#18696 Fixes: nodejs#18303 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Make sure that inspector ports in cluster are inside the valid range:
[1024, 65535]
.Fix flaky
test-inspector-port-zero-cluster
.Fixes: #18303
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)