Skip to content

Commit ed080d8

Browse files
lpincaaduh95
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 e247a61 commit ed080d8

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const workerCount = 4;
3333
constexpectedReqCount=16;
3434

3535
if(cluster.isPrimary){
36+
letlisteningCount=0;
3637
letreusedCount=0;
3738
letreqCount=0;
3839
letlastSession=null;
39-
letshootOnce=false;
4040
letworkerPort=null;
4141

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

0 commit comments

Comments
 (0)