Browse Source

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: https://github.com/nodejs/node/issues/4887
PR-URL: https://github.com/nodejs/node/pull/4934
Reviewed-By: James M Snell <jasnell@gmail.com>
process-exit-stdio-flushing
Rich Trott 9 years ago
parent
commit
25f8a0d2dc
  1. 13
      test/parallel/test-cluster-shared-leak.js

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

@ -17,8 +17,8 @@ if (cluster.isMaster) {
worker2 = cluster.fork();
worker2.on('online', function() {
conn = net.connect(common.PORT, common.mustCall(function() {
worker1.send('die');
worker2.send('die');
worker1.disconnect();
worker2.disconnect();
}));
conn.on('error', function(e) {
// ECONNRESET is OK
@ -39,17 +39,10 @@ if (cluster.isMaster) {
return;
}
var server = net.createServer(function(c) {
const server = net.createServer(function(c) {
c.end('bye');
});
server.listen(common.PORT, function() {
process.send('listening');
});
process.on('message', function(msg) {
if (msg !== 'die') return;
server.close(function() {
setImmediate(() => process.disconnect());
});
});

Loading…
Cancel
Save