Skip to content

Commit b44b6af

Browse files
Imran Iqbalrvagg
Imran Iqbal
authored andcommitted
test: Fix test-cluster-worker-exit.js for AIX
test fails intermittently due to the assertion that the 'disconnect' event should come before the 'exit' event. This is caused be the non-deteministic behaviour of pollset_poll[1] on AIX (see deps/uv/src/unix/aix.c). This API makes no garauntee for the order in which file descriptors are returned. On linux epoll_wait[2] is used, which also does not make a garauntee on order of file descriptors returned. In the failing case we recieve our file descriptor with a callback of uv__signal_event (which causes JavaScript to receive the exit event) before our file descriptor with uv__stream_io as its callback (which in turn causes JavaScript receive the disconnect event). This change simply removes the assertion that the disconnect event happens before exit event and processes the test regardless of which event comes first. [1] https://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.ai x.basetrf1/pollset.htm [2] http://linux.die.net/man/2/epoll_pwait PR-URL: #3666 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 9469424 commit b44b6af

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/parallel/test-cluster-worker-exit.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,16 @@ if (cluster.isWorker) {
6060
results.cluster_exitCode = worker.process.exitCode;
6161
results.cluster_signalCode = worker.process.signalCode;
6262
results.cluster_emitExit += 1;
63-
assert.ok(results.cluster_emitDisconnect,
64-
"cluster: 'exit' event before 'disconnect' event");
6563
});
6664

6765
// Check worker events and properties
6866
worker.on('disconnect', function() {
6967
results.worker_emitDisconnect += 1;
7068
results.worker_suicideMode = worker.suicide;
7169
results.worker_state = worker.state;
70+
if (results.worker_emitExit > 0) {
71+
process.nextTick(function() { finish_test(); });
72+
}
7273
});
7374

7475
// Check that the worker died
@@ -77,10 +78,9 @@ if (cluster.isWorker) {
7778
results.worker_signalCode = signalCode;
7879
results.worker_emitExit += 1;
7980
results.worker_died = !alive(worker.process.pid);
80-
assert.ok(results.worker_emitDisconnect,
81-
"worker: 'exit' event before 'disconnect' event");
82-
83-
process.nextTick(function() { finish_test(); });
81+
if (results.worker_emitDisconnect > 0) {
82+
process.nextTick(function() { finish_test(); });
83+
}
8484
});
8585

8686
var finish_test = function() {

0 commit comments

Comments
 (0)