Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
617ee32
src: fix memory leak in ExternString
skomski Aug 16, 1970
56d9584
child_process: add callback parameter to .send()
bnoordhuis Aug 30, 2015
abbc8db
test: mark eval_messages as flaky
orangemocha Sep 2, 2015
6ce8f5f
doc: reorder collaborators by their usernames
jbergstroem Jul 25, 2015
47e5cf7
doc: update url doc to account for escaping
Fishrock123 Aug 28, 2015
8ca9ea2
test: refactor to eliminate flaky test
Trott Aug 29, 2015
107cbd6
child_process: check execFile and fork args
jasnell Sep 2, 2015
4a1b519
build: add --enable-asan with builtin leakcheck
skomski Aug 14, 2015
b513a33
events,lib: don't require EE#listenerCount()
Fishrock123 Sep 2, 2015
1134188
deps: upgrade V8 to 4.5.103.24
ofrobots Aug 23, 2015
a7392ff
src: apply debug force load fixups from 41e63fb
ofrobots Aug 23, 2015
709ed15
contextify: ignore getters during initialization
indutny Jul 7, 2015
06f38de
test: fix test-repl-tab-complete.js for V8 4.5
ofrobots Aug 23, 2015
39aa573
src: enable v8 deprecation warnings and fix them
bnoordhuis Jul 1, 2015
d08bb97
src: replace usage of v8::Handle with v8::Local
targos Jul 18, 2015
564e214
src: enable vector ics on arm again
ofrobots Aug 23, 2015
074315f
src: re-enable fast math on arm
targos Aug 28, 2015
64beab0
deps: upgrade V8 to 4.5.103.30
ofrobots Sep 1, 2015
fc66eed
test: fix use of `common` before required
rvagg Sep 4, 2015
eefe14c
buffer: SlowBuffer only accept valid numeric values
targos Sep 1, 2015
a338eb3
doc,test: enable recursive file watching in Windows
thefourtheye Sep 2, 2015
80bcab9
src: fix buffer overflow for long exception lines
skomski Sep 3, 2015
3a731da
src: use standard conform snprintf on windows
skomski Sep 3, 2015
a6cb3a5
doc: update environment vars in manpage and --help
silverwind Sep 4, 2015
880410d
doc: add TSC meeting minutes 2015-09-02
rvagg Sep 3, 2015
63a628d
build: fix .pkg creation tooling
rvagg Sep 4, 2015
d0c682a
deps: backport 75e43a6 from v8 upstream (again)
Aug 11, 2015
50717a6
build: make .msi install to "nodejs", not "node"
rvagg Sep 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: refactor to eliminate flaky test
This retains the key elements of test-child-process-fork-getconnections
(forks a child process, sends a bunch of sockets, uses getConnections()
to enumerate them) but contains some code to work around an apparent
intermittent bug that occurs on OS X where a socket seems to close
itself unexpectedly.

#2610 was opened for the bug that
was causing the problem in the first place.

PR-URL: #2609
Fixes: #1100
Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
  • Loading branch information
Trott committed Sep 3, 2015
commit 8ca9ea23408037ea289ffc845c2c7e754acd8fc7
1 change: 0 additions & 1 deletion test/sequential/sequential.status
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ prefix sequential
# sample-test : PASS,FLAKY

[true] # This section applies to all platforms
test-child-process-fork-getconnections : PASS,FLAKY
test-repl-persistent-history : PASS,FLAKY

[$system==win32]
Expand Down
59 changes: 30 additions & 29 deletions test/sequential/test-child-process-fork-getconnections.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,71 @@
'use strict';
var assert = require('assert');
var common = require('../common');
var fork = require('child_process').fork;
var net = require('net');
var count = 12;
const assert = require('assert');
const common = require('../common');
const fork = require('child_process').fork;
const net = require('net');
const count = 12;

if (process.argv[2] === 'child') {
var sockets = [];
var id = process.argv[3];
let sockets = [];

process.on('message', function(m, socket) {
function sendClosed(id) {
process.send({ id: id, status: 'closed'});
};

if (m.cmd === 'new') {
assert(socket);
assert(socket instanceof net.Socket, 'should be a net.Socket');
sockets.push(socket);
socket.on('end', function() {
if (!this.closingOnPurpose)
throw new Error('[c] closing by accident!');
});
}

if (m.cmd === 'close') {
assert.equal(socket, undefined);
sockets[m.id].once('close', function() {
process.send({ id: m.id, status: 'closed' });
});
sockets[m.id].destroy();
if (sockets[m.id].destroyed) {
// Workaround for https://github.com/nodejs/node/issues/2610
sendClosed(m.id);
// End of workaround. When bug is fixed, this code can be used instead:
// throw new Error('socket destroyed unexpectedly!');
} else {
sockets[m.id].once('close', sendClosed.bind(null, m.id));
sockets[m.id].destroy();
}
}
});

} else {
var child = fork(process.argv[1], ['child']);
const child = fork(process.argv[1], ['child']);

child.on('exit', function(code, signal) {
if (!childKilled)
throw new Error('child died unexpectedly!');
});

var server = net.createServer();
var sockets = [];
var sent = 0;
const server = net.createServer();
let sockets = [];
let sent = 0;

server.on('connection', function(socket) {
child.send({ cmd: 'new' }, socket, { track: false });
child.send({ cmd: 'new' }, socket);
sockets.push(socket);

if (sockets.length === count) {
closeSockets(0);
}
});

var disconnected = 0;
var clients = [];
let disconnected = 0;
server.on('listening', function() {
var j = count, client;
let j = count, client;
while (j--) {
client = net.connect(common.PORT, '127.0.0.1');
client.id = j;
client.on('close', function() {
disconnected += 1;
});
clients.push(client);
}
});

var childKilled = false;
let childKilled = false;
function closeSockets(i) {
if (i === count) {
childKilled = true;
Expand All @@ -73,17 +74,17 @@ if (process.argv[2] === 'child') {
return;
}

sent++;
child.send({ id: i, cmd: 'close' });
child.once('message', function(m) {
assert(m.status === 'closed');
server.getConnections(function(err, num) {
closeSockets(i + 1);
});
});
sent++;
child.send({ id: i, cmd: 'close' });
};

var closeEmitted = false;
let closeEmitted = false;
server.on('close', function() {
closeEmitted = true;
});
Expand Down