test: fix child-process-fork-regr-gh-2847
authorSantiago Gimeno <santiago.gimeno@gmail.com>
Sat, 6 Feb 2016 15:19:03 +0000 (16:19 +0100)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
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: https://github.com/nodejs/node/pull/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: https://github.com/nodejs/node/issues/3635

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

index 0835362..6419ef3 100644 (file)
@@ -13,7 +13,6 @@ test-tick-processor                  : PASS,FLAKY
 
 [$system==linux]
 test-tick-processor                  : PASS,FLAKY
-test-child-process-fork-regr-gh-2847 : PASS,FLAKY
 
 [$system==macos]
 
index 78856cb..ad05642 100644 (file)
@@ -6,9 +6,6 @@ const assert = require('assert');
 const cluster = require('cluster');
 const net = require('net');
 
-var connectcount = 0;
-var sendcount = 0;
-
 if (!cluster.isMaster) {
   // Exit on first received handle to leave the queue non-empty in master
   process.on('message', function() {
@@ -18,13 +15,6 @@ if (!cluster.isMaster) {
 }
 
 var server = net.createServer(function(s) {
-  if (common.isWindows) {
-    s.on('error', function(err) {
-      // Prevent possible ECONNRESET errors from popping up
-      if (err.code !== 'ECONNRESET' || sendcount === 0)
-        throw err;
-    });
-  }
   setTimeout(function() {
     s.destroy();
   }, 100);
@@ -34,21 +24,6 @@ var server = net.createServer(function(s) {
   function send(callback) {
     var s = net.connect(common.PORT, function() {
       worker.send({}, s, callback);
-      connectcount++;
-    });
-
-    // Errors can happen if the connections
-    // are still happening while the server has been closed.
-    // This can happen depending on how the messages are
-    // bundled into packets. If they all make it into the first
-    // one then no errors will occur, otherwise the server
-    // may have been closed by the time the later ones make
-    // it to the server side.
-    // We ignore any errors that occur after some connections
-    // get through
-    s.on('error', function(err) {
-      if (connectcount < 3)
-        console.log(err);
     });
   }
 
@@ -58,11 +33,7 @@ var server = net.createServer(function(s) {
     server.close();
   }));
 
-  // Queue up several handles, to make `process.disconnect()` wait
-  for (var i = 0; i < 100; i++)
-    send(function(err) {
-      if (err && sendcount < 3)
-        console.log(err);
-      sendcount++;
-    });
+  // Send 2 handles to make `process.disconnect()` wait
+  send();
+  send();
 });