Skip to content

Commit 4e4b260

Browse files
santigimenoTrott
authored andcommitted
test: fix child-process-fork-regr-gh-2847
The test would sometimes time out on some platforms. Take the initial version of the test and instead of sending 100 handles, just send 2. It still fails when run with the code before the change was introduced and passes afterwards. Remove test from parallel.status. PR-URL: #5121 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Fixes: #3635
1 parent 1693349 commit 4e4b260

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

test/parallel/parallel.status

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ test-tick-processor : PASS,FLAKY
1313

1414
[$system==linux]
1515
test-tick-processor : PASS,FLAKY
16-
test-child-process-fork-regr-gh-2847 : PASS,FLAKY
1716

1817
[$system==macos]
1918

test/parallel/test-child-process-fork-regr-gh-2847.js

+3-32
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ const assert = require('assert');
66
const cluster = require('cluster');
77
const net = require('net');
88

9-
var connectcount = 0;
10-
var sendcount = 0;
11-
129
if (!cluster.isMaster) {
1310
// Exit on first received handle to leave the queue non-empty in master
1411
process.on('message', function() {
@@ -18,13 +15,6 @@ if (!cluster.isMaster) {
1815
}
1916

2017
var server = net.createServer(function(s) {
21-
if (common.isWindows) {
22-
s.on('error', function(err) {
23-
// Prevent possible ECONNRESET errors from popping up
24-
if (err.code !== 'ECONNRESET' || sendcount === 0)
25-
throw err;
26-
});
27-
}
2818
setTimeout(function() {
2919
s.destroy();
3020
}, 100);
@@ -34,21 +24,6 @@ var server = net.createServer(function(s) {
3424
function send(callback) {
3525
var s = net.connect(common.PORT, function() {
3626
worker.send({}, s, callback);
37-
connectcount++;
38-
});
39-
40-
// Errors can happen if the connections
41-
// are still happening while the server has been closed.
42-
// This can happen depending on how the messages are
43-
// bundled into packets. If they all make it into the first
44-
// one then no errors will occur, otherwise the server
45-
// may have been closed by the time the later ones make
46-
// it to the server side.
47-
// We ignore any errors that occur after some connections
48-
// get through
49-
s.on('error', function(err) {
50-
if (connectcount < 3)
51-
console.log(err);
5227
});
5328
}
5429

@@ -58,11 +33,7 @@ var server = net.createServer(function(s) {
5833
server.close();
5934
}));
6035

61-
// Queue up several handles, to make `process.disconnect()` wait
62-
for (var i = 0; i < 100; i++)
63-
send(function(err) {
64-
if (err && sendcount < 3)
65-
console.log(err);
66-
sendcount++;
67-
});
36+
// Send 2 handles to make `process.disconnect()` wait
37+
send();
38+
send();
6839
});

0 commit comments

Comments
 (0)