Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c44db7f

Browse filesBrowse files
addaleaxtargos
authored andcommitted
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 <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
1 parent dd53e6a commit c44db7f
Copy full SHA for c44db7f

File tree

Expand file treeCollapse file tree

2 files changed

+8
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-4
lines changed
Open diff view settings
Collapse file

‎test/parallel/parallel.status‎

Copy file name to clipboardExpand all lines: test/parallel/parallel.status
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ test-worker-memory: PASS,FLAKY
2121
test-http2-client-upload: PASS,FLAKY
2222
# https://github.com/nodejs/node/issues/20750
2323
test-http2-client-upload-reject: PASS,FLAKY
24-
# https://github.com/nodejs/node/issues/28106
25-
test-worker-debug: PASS,FLAKY
2624

2725
[$system==linux]
2826

Collapse file

‎test/parallel/test-worker-debug.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-worker-debug.js
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,17 @@ async function testWaitForDisconnectInWorker(session, post) {
240240
});
241241
await workerSession1.post('Runtime.runIfWaitingForDebugger');
242242

243+
// Create the promises before sending the exit message to the Worker in order
244+
// to avoid race conditions.
245+
const disconnectPromise =
246+
waitForEvent(workerSession1, 'NodeRuntime.waitingForDisconnect');
247+
const executionContextDestroyedPromise =
248+
waitForEvent(workerSession2, 'Runtime.executionContextDestroyed');
243249
worker.postMessage('resume');
244250

245-
await waitForEvent(workerSession1, 'NodeRuntime.waitingForDisconnect');
251+
await disconnectPromise;
246252
post('NodeWorker.detach', { sessionId: sessionId1 });
247-
await waitForEvent(workerSession2, 'Runtime.executionContextDestroyed');
253+
await executionContextDestroyedPromise;
248254

249255
await exitPromise;
250256

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.