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:Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By:
James M Snell <jasnell@gmail.com>
parent
fcb46a46
Please register or sign in to comment