Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
09bc0c6
doc: improvements to crypto.markdown copy
jasnell Dec 27, 2015
ac1108d
doc: add missing backtick for readline
mscdex Jan 6, 2016
e703c9a
doc: bring releases.md up to date
cjihrig Jan 5, 2016
ec73c69
doc: add Myles Borins to Release Team
Jan 8, 2016
0126615
doc: add Evan Lucas to Release Team
evanlucas Jan 8, 2016
ff539c5
cluster: ignore queryServer msgs on disconnection
santigimeno Dec 29, 2015
97aaeb8
doc: fix description about the latest-codename
JungMinu Jan 8, 2016
799aa74
net: fix dns lookup for android
daguej Jan 8, 2016
9accebe
net, doc: fix line wrapping lint in net.js
jasnell Jan 8, 2016
b181e26
doc: document http's server.listen return value
Sequoia Jan 8, 2016
fdfc72c
doc: label http.IncomingMessage as a Class
Sequoia Jan 8, 2016
ede98d1
doc: stronger suggestion for userland assert
geek Jan 5, 2016
6f9a96f
test: fix flaky unrefed timers test
Trott Jan 9, 2016
b515ccc
stream: remove useless if test in transform
zoubin Jan 11, 2016
df87176
doc: update stylesheet to match frontpage
silverwind Jan 11, 2016
102fb7d
doc: remove "above" and "below" references
richardsun29 Jan 5, 2016
f28a640
test: only include http module once
Trott Jan 10, 2016
145b668
module: move unnecessary work for early return
zertosh Oct 29, 2015
b14b2ae
test: require common module only once
Trott Jan 10, 2016
37a546b
src: remove redeclarations of variables
Trott Jan 10, 2016
787c5d9
http: remove variable redeclaration
Trott Jan 10, 2016
3912b5c
doc: adds usage of readline line-by-line parsing
eljefedelrodeodeljefe Jan 10, 2016
b70eec8
tls_legacy: do not read on OpenSSL's stack
indutny Jan 6, 2016
ffb7deb
net: remove hot path comment from connect
evanlucas Jan 12, 2016
ea6e26d
test: remove duplicate fork module import
Trott Jan 11, 2016
ff99203
2016-01-12, Version 5.4.1 (Stable)
Jan 11, 2016
e7d1c69
Working on v5.4.2
Jan 11, 2016
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
cluster: ignore queryServer msgs on disconnection
It avoids the creation of unnecessary handles. This issue is causing
intermitent failures in `test-cluster-disconnect-race` on `FreeBSD`
and `OS X`.

The problem is that the `worker2.disconnect` is being called on the
master before the `queryServer` is handled, causing the worker to
be deleted, then the Server handle is created afterwards. Later on,
when `removeWorker` is called from the `exit` handler, there are no
workers left, but one handle, thus the `AssertionError`.

Add a new `test/sequential/test-cluster-disconnect-leak` based on
`test-cluster-disconnect-race` that creates lots of workers and fails
consistently without this patch.

PR-URL: #4465
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
santigimeno authored and Myles Borins committed Jan 12, 2016
commit ff539c5bb55c828c538665f07ed6d31d34c4ed22
3 changes: 3 additions & 0 deletions lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ function masterInit() {
}

function queryServer(worker, message) {
// Stop processing if worker already disconnecting
if (worker.suicide)
return;
var args = [message.address,
message.port,
message.addressType,
Expand Down
47 changes: 47 additions & 0 deletions test/sequential/test-cluster-disconnect-leak.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
'use strict';
// Flags: --expose-internals

const common = require('../common');
const assert = require('assert');
const net = require('net');
const cluster = require('cluster');
const handles = require('internal/cluster').handles;
const os = require('os');

if (common.isWindows) {
console.log('1..0 # Skipped: This test does not apply to Windows.');
return;
}

cluster.schedulingPolicy = cluster.SCHED_NONE;

if (cluster.isMaster) {
const cpus = os.cpus().length;
const tries = cpus > 8 ? 128 : cpus * 16;

const worker1 = cluster.fork();
worker1.on('message', common.mustCall(() => {
worker1.disconnect();
for (let i = 0; i < tries; ++ i) {
const w = cluster.fork();
w.on('online', common.mustCall(w.disconnect));
}
}));

cluster.on('exit', common.mustCall((worker, code) => {
assert.strictEqual(code, 0, 'worker exited with error');
}, tries + 1));

process.on('exit', () => {
assert.deepEqual(Object.keys(cluster.workers), []);
assert.strictEqual(Object.keys(handles).length, 0);
});

return;
}

var server = net.createServer();

server.listen(common.PORT, function() {
process.send('listening');
});