-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix flaky cluster-disconnect-race #4457
test: fix flaky cluster-disconnect-race #4457
Conversation
@@ -16,12 +16,14 @@ if (cluster.isMaster) { | |||
worker1.on('message', common.mustCall(function() { | |||
worker2 = cluster.fork(); | |||
worker1.disconnect(); | |||
worker2.on('online', common.mustCall(worker2.disconnect)); | |||
worker2.on('online', common.mustCall(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just worker2.on('message', ...)
by itself rather than wrapped inside a worker2.on('online', ...)
?
Seems to blow up a bit on ubuntu more often than not...
|
Yeah I'm seeing that now. Looking into it... |
a6f4f4f
to
dd5f204
Compare
Ok that should be fixed now. |
Stress test is green! \o/ General CI run: https://ci.nodejs.org/job/node-test-pull-request/1101/ |
Unfortunately, this change means that the test no longer fails in Node 5.3.0, which means that it doesn't test the issue it was written to test anymore. (Tested on ubuntu 14.04.) |
I think the issue in the test that you've fixed is the source of the race condition that's supposed to be tested here. It's a feature and not a bug. Maybe the thing to do is swallow EPIPE on Windows. Another perhaps better option is to skip the test on anything that isn't Linux, since that's the only place (that I know of, anyway) where the thing (that this test detects) ever happened. |
I thought about that, but swallowing EPIPE seems like a bad idea since then it would appear as though the |
Maybe just skipping the test on Windows since the test does not test the issue it is supposed to test on Windows anyway (perhaps because the issue never existed there). In Node 5.3.0, it blows up on Linux but not on Windows. It's supposed to blow up in Node 5.3.0. Either this issue never manifested itself on Windows or else it did but this test never caught it anyway. (I'm guessing the former.) |
dd5f204
to
192c097
Compare
@Trott Ok, I've modified it to just skip on Windows and left in a couple extra |
@@ -7,6 +7,12 @@ const common = require('../common'); | |||
const assert = require('assert'); | |||
const net = require('net'); | |||
const cluster = require('cluster'); | |||
|
|||
if (common.isWindows) { | |||
console.log('1..0 # Skipped: This test is disabled on windows.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Windows
rather than windows
Nit: is disabled on Windows
makes it sound like we just gave up and hope to enable it one day. I'd rather convey a message that it just doesn't apply to Windows. Maybe: Skipped: This test does not apply to Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I just copied this directly from another test that presumably was doing a check for the same reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh. Either way. It's a nit.
A couple of nits that you can take or leave (because, hey, that's what a nit is). Beyond that, yeah, totally LGTM if CI is happy and as long as it still fails on Linux on Node 5.3.0. |
On single core Windows systems, process.send() would cause an EPIPE because of the ordering of the IPC channel disconnect and the process.send(). The test was originally only relevant for non-Windows platforms, so this commit merely skips the test on Windows. Fixes: nodejs#4450 PR-URL: nodejs#4457
192c097
to
d2d7c94
Compare
Wording fixed. One last CI run: https://ci.nodejs.org/job/node-test-pull-request/1103/ |
Behaves as expected with Node 5.3.0 on Ubuntu 14.04. |
On single core Windows systems, process.send() would cause an EPIPE because of the ordering of the IPC channel disconnect and the process.send(). The test was originally only relevant for non-Windows platforms, so this commit merely skips the test on Windows. Fixes: #4450 PR-URL: #4457 Reviewed-By: Rich Trott <rtrott@gmail.com>
Landed in fd551c3. |
On single core Windows systems, process.send() would cause an EPIPE because of the ordering of the IPC channel disconnect and the process.send(). The test was originally only relevant for non-Windows platforms, so this commit merely skips the test on Windows. Fixes: nodejs#4450 PR-URL: nodejs#4457 Reviewed-By: Rich Trott <rtrott@gmail.com>
On single core Windows systems, process.send() would cause an EPIPE because of the ordering of the IPC channel disconnect and the process.send(). The test was originally only relevant for non-Windows platforms, so this commit merely skips the test on Windows. Fixes: #4450 PR-URL: #4457 Reviewed-By: Rich Trott <rtrott@gmail.com>
On single core Windows systems, process.send() would cause an EPIPE because of the ordering of the IPC channel disconnect and the process.send(). The test was originally only relevant for non-Windows platforms, so this commit merely skips the test on Windows. Fixes: #4450 PR-URL: #4457 Reviewed-By: Rich Trott <rtrott@gmail.com>
On single core Windows systems, process.send() would cause an EPIPE because of the ordering of the IPC channel disconnect and the process.send(). The test was originally only relevant for non-Windows platforms, so this commit merely skips the test on Windows. Fixes: nodejs#4450 PR-URL: nodejs#4457 Reviewed-By: Rich Trott <rtrott@gmail.com>
Before this commit, on single core Windows systems
process.send()
would cause an EPIPE because of the ordering of the IPC channel disconnect and theprocess.send()
.Disconnecting the second worker once it receives the sent message vs. when the worker merely comes online fixes this race condition.
Fixes: #4450