Skip to content

Commit

Permalink
test: eliminate port collision
Browse files Browse the repository at this point in the history
In test test-cluster-net-listen-ipv6only-rr, the cluster member that
listens to `any` port actually has the potential to `grab` any port
from the environment which when passed onto the master causes
collision when it tries to listen on.

Moving the test to sequential alone is not sufficient as the cluster
member can in theory catch on to the admin ports on the host.

Assigning static port alone is also not sufficient, as it can interfere
with other running tests in the parallel category which would be mostly
running with `port: any` fashion.

So move to sequential, and use a static port.

Fixes: #25813
PR-URL: #26298
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
  • Loading branch information
gireeshpunathil authored and addaleax committed Mar 1, 2019
1 parent 1abe1d1 commit d8f5f55
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ if (cluster.isMaster) {
workers.set(i, worker);
}
} else {
// As the cluster member has the potential to grab any port
// from the environment, this can cause collision when master
// obtains the port from cluster member and tries to listen on.
// So move this to sequential, and provide a static port.
// Refs: https://github.com/nodejs/node/issues/25813
net.createServer().listen({
host,
port: 0,
host: host,
port: common.PORT,
ipv6Only: true,
}, common.mustCall());
}

0 comments on commit d8f5f55

Please sign in to comment.