Commit 5eed20b
worker: fix race condition in node_messaging.cc
`AddToIncomingQueue()` relies on `owner_` only being modified with
`mutex_` being locked, but in these two places, that didn’t happen.
Modify them to use `Detach()` instead, which has the same effect
as setting `owner_ = nullptr` here, but does it with proper locking.
This race condition probably only shows up in practice when Node.js
is compiled in debug mode, because the compiler eliminates the
duplicate load in `AddToIncomingQueue()` when compiling with
optimizations enabled.
PR-URL: #33429
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent c797c7c commit 5eed20b
1 file changed
+3
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
498 | | - | |
| 497 | + | |
499 | 498 | | |
500 | 499 | | |
501 | 500 | | |
| |||
692 | 691 | | |
693 | 692 | | |
694 | 693 | | |
695 | | - | |
696 | | - | |
| 694 | + | |
| 695 | + | |
697 | 696 | | |
698 | | - | |
699 | 697 | | |
700 | 698 | | |
701 | 699 | | |
| |||
0 commit comments