Skip to content

Commit

Permalink
test: ensure that all worker servers are ready
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
lpinca authored Apr 19, 2024
1 parent 91661ec commit 580aae5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/parallel/test-tls-ticket-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ const workerCount = 4;
const expectedReqCount = 16;

if (cluster.isPrimary) {
let listeningCount = 0;
let reusedCount = 0;
let reqCount = 0;
let lastSession = null;
let shootOnce = false;
let workerPort = null;

function shoot() {
Expand Down Expand Up @@ -73,9 +73,8 @@ if (cluster.isPrimary) {
console.error('[primary] got %j', msg);
if (msg === 'reused') {
++reusedCount;
} else if (msg === 'listening' && !shootOnce) {
workerPort = port || workerPort;
shootOnce = true;
} else if (msg === 'listening' && ++listeningCount === workerCount) {
workerPort = port;
shoot();
}
});
Expand Down

0 comments on commit 580aae5

Please sign in to comment.