diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2018-02-10 16:52:18 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-22 13:06:21 +0300 |
commit | 45982de4184e66bb53577b9c07383189f3d83dde (patch) | |
tree | 6e4a28ebc2efdf3340fdd333d9ee51bdbfd2cf12 /lib/internal/cluster | |
parent | 2990429b16f32c216d357a5cbf3f81d43aa8abaf (diff) |
cluster: fix inspector port assignment
Make sure that inspector ports in cluster are inside the valid range:
`[1024, 65535]`.
Fixes flaky `test-inspector-port-zero-cluster`.
PR-URL: https://github.com/nodejs/node/pull/18696
Fixes: https://github.com/nodejs/node/issues/18303
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/internal/cluster')
-rw-r--r-- | lib/internal/cluster/master.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/internal/cluster/master.js b/lib/internal/cluster/master.js index 570cf7bc6f9..3c6a398f117 100644 --- a/lib/internal/cluster/master.js +++ b/lib/internal/cluster/master.js @@ -14,6 +14,7 @@ const intercom = new EventEmitter(); const SCHED_NONE = 1; const SCHED_RR = 2; const { isLegalPort } = require('internal/net'); +const [ minPort, maxPort ] = [ 1024, 65535 ]; module.exports = cluster; @@ -119,6 +120,8 @@ function createWorkerProcess(id, env) { } } else { inspectPort = process.debugPort + debugPortOffset; + if (inspectPort > maxPort) + inspectPort = inspectPort - maxPort + minPort - 1; debugPortOffset++; } |