Skip to content
Browse files

test: fix flaky test-worker-debug

Address a race condition in the test; the Worker’s exit events
may have been not recorded because the Worker exited before
the listeners were attached.

Fix the by attaching the event listeners before telling the Worker
to exit.

PR-URL: #28307
Fixes: #28299
Fixes: #28106
Reviewed-By: Richard Lau <>
Reviewed-By: Colin Ihrig <>
Reviewed-By: Yongsheng Zhang <>
  • Loading branch information...
addaleax authored and targos committed Jun 19, 2019
1 parent dd53e6a commit c44db7fea595415c39e217f1c1cc593df1acffb6
Showing with 8 additions and 4 deletions.
  1. +0 −2 test/parallel/parallel.status
  2. +8 −2 test/parallel/test-worker-debug.js
@@ -21,8 +21,6 @@ test-worker-memory: PASS,FLAKY
test-http2-client-upload: PASS,FLAKY
test-http2-client-upload-reject: PASS,FLAKY
test-worker-debug: PASS,FLAKY


@@ -240,11 +240,17 @@ async function testWaitForDisconnectInWorker(session, post) {

// Create the promises before sending the exit message to the Worker in order
// to avoid race conditions.
const disconnectPromise =
waitForEvent(workerSession1, 'NodeRuntime.waitingForDisconnect');
const executionContextDestroyedPromise =
waitForEvent(workerSession2, 'Runtime.executionContextDestroyed');

await waitForEvent(workerSession1, 'NodeRuntime.waitingForDisconnect');
await disconnectPromise;
post('NodeWorker.detach', { sessionId: sessionId1 });
await waitForEvent(workerSession2, 'Runtime.executionContextDestroyed');
await executionContextDestroyedPromise;

await exitPromise;

0 comments on commit c44db7f

Please sign in to comment.
You can’t perform that action at this time.