Unverified Commit e3bae655 authored by Anna Henningsen's avatar Anna Henningsen
Browse files

worker: fix deadlock when calling terminate from exit handler

Just before we call the `'exit'` handlers of a Worker, we drain
the public port’s message queue to ensure proper ordering.
Previously, we held the Worker’s `mutex_` during the
exit handler call, so calling `terminate()` on the worker
could lead to a deadlock if called from one of those message
handlers.

This fixes flakiness in the `parallel/test-worker-dns-terminate` test.

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


Reviewed-By: default avatarEugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
parent fcb46a46
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