Skip to content
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

Closed

Conversation

santigimeno
Copy link
Member

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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

@nodejs-github-bot nodejs-github-bot added the cluster Issues and PRs related to the cluster subsystem. label Feb 10, 2018
@santigimeno
Copy link
Member Author

@@ -119,6 +119,9 @@ function createWorkerProcess(id, env) {
}
} else {
inspectPort = process.debugPort + debugPortOffset;
const offset = inspectPort - 65535;
if (offset > 0)
inspectPort = 1023 + offset;
Copy link
Member

@ChALkeR ChALkeR Feb 10, 2018

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 ;-)

Copy link
Contributor

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 :)

@daynin
Copy link
Contributor

daynin commented Feb 10, 2018

@santigimeno hi! You have a little typo in the title "inpector" -> "inspector"

@tniessen tniessen changed the title cluster: fix inpector port assignment cluster: fix inspector port assignment Feb 11, 2018
Copy link
Contributor

@cjihrig cjihrig left a 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) => {
Copy link
Contributor

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.

Make sure that inspector ports in cluster are inside the valid range:
`[1024, 65535]`.
Fix flaky `test-inspector-port-zero-cluster`.

Fixes: nodejs#18303
@santigimeno
Copy link
Member Author

Comments addressed. CI: https://ci.nodejs.org/job/node-test-pull-request/13249/

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 18, 2018
@BridgeAR
Copy link
Member

Landed in 45982de 🎉

@BridgeAR BridgeAR closed this Feb 22, 2018
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Feb 22, 2018
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 <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
addaleax pushed a commit to addaleax/node that referenced this pull request Feb 26, 2018
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 <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
addaleax pushed a commit that referenced this pull request Feb 26, 2018
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 <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@addaleax addaleax mentioned this pull request Feb 27, 2018
MylesBorins pushed a commit that referenced this pull request Apr 13, 2018
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 <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request May 2, 2018
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
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 <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. cluster Issues and PRs related to the cluster subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cluster,test: failing cluster+inspector test when using port 65535
7 participants