Skip to content

Commit efbb654

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
test: fix flaky cluster test on Windows 10
test-cluster-shared-leak was flaky on Windows 10. Remove unnecessary .send() calls and replace with .disconnect() to avoid spurious EPIPE. Fixes: #4887 PR-URL: #4934 Reviewed-By: James M Snell <[email protected]>
1 parent 643b581 commit efbb654

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

test/parallel/test-cluster-shared-leak.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ if (cluster.isMaster) {
1717
worker2 = cluster.fork();
1818
worker2.on('online', function() {
1919
conn = net.connect(common.PORT, common.mustCall(function() {
20-
worker1.send('die');
21-
worker2.send('die');
20+
worker1.disconnect();
21+
worker2.disconnect();
2222
}));
2323
conn.on('error', function(e) {
2424
// ECONNRESET is OK
@@ -39,17 +39,10 @@ if (cluster.isMaster) {
3939
return;
4040
}
4141

42-
var server = net.createServer(function(c) {
42+
const server = net.createServer(function(c) {
4343
c.end('bye');
4444
});
4545

4646
server.listen(common.PORT, function() {
4747
process.send('listening');
4848
});
49-
50-
process.on('message', function(msg) {
51-
if (msg !== 'die') return;
52-
server.close(function() {
53-
setImmediate(() => process.disconnect());
54-
});
55-
});

0 commit comments

Comments
 (0)