Commit 677d10c
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: #22073
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 5018661 commit 677d10c
1 file changed
+12
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
292 | 293 | | |
293 | | - | |
| 294 | + | |
294 | 295 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
299 | 300 | | |
300 | | - | |
301 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
302 | 304 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | 305 | | |
307 | 306 | | |
308 | 307 | | |
| |||
369 | 368 | | |
370 | 369 | | |
371 | 370 | | |
| 371 | + | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| |||
0 commit comments