Skip to content

Commit 6da558a

Browse files
lpincamarco-ippolito
authored andcommitted
test: ensure that all worker servers are ready
Wait for the `'listening'` message from all workers before creating the first connection. This fixes an `EMFILE` error that is raised on Windows when running the following command ``` python tools/test.py -J --repeat=1000 parallel/test-tls-ticket-cluster ``` PR-URL: #52563 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent c871fad commit 6da558a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

test/parallel/test-tls-ticket-cluster.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const workerCount = 4;
3333
const expectedReqCount = 16;
3434

3535
if (cluster.isPrimary) {
36+
let listeningCount = 0;
3637
let reusedCount = 0;
3738
let reqCount = 0;
3839
let lastSession = null;
39-
let shootOnce = false;
4040
let workerPort = null;
4141

4242
function shoot() {
@@ -73,9 +73,8 @@ if (cluster.isPrimary) {
7373
console.error('[primary] got %j', msg);
7474
if (msg === 'reused') {
7575
++reusedCount;
76-
} else if (msg === 'listening' && !shootOnce) {
77-
workerPort = port || workerPort;
78-
shootOnce = true;
76+
} else if (msg === 'listening' && ++listeningCount === workerCount) {
77+
workerPort = port;
7978
shoot();
8079
}
8180
});

0 commit comments

Comments
 (0)