Unverified Commit 5eed20b3 authored by Anna Henningsen's avatar Anna Henningsen Committed by Shelley Vohr
Browse files

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: https://github.com/nodejs/node/pull/33429


Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarDavid Carlier <devnexen@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
parent c797c7c7
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