Commit 0279c2f2 authored by Anna Henningsen's avatar Anna Henningsen Committed by Rich Trott
Browse files

test: fix flaky test-inspector-connect-main-thread

Previously, the test waited for a (any) message from the workers,
and then attached another event listener to a specific kind of
message. However, it was possible that the second listener was
attached after the Worker had already exited, thus never receiving
the message it was supposed to receive. (This is the race condition
here – usually, the Worker thread would exit *after* the second
listener was attached.)

Solve this by keeping a single `'message'` event listener attached
to the worker instance during its entire lifetime.

Fixes: https://github.com/nodejs/node/issues/31226

PR-URL: https://github.com/nodejs/node/pull/31637


Reviewed-By: default avatarEugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
parent 8c18e91c
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment