Skip to content

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

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading