Jed Davis 48864d54a3 Bug 1880590 - Fix benign data race during fork server shutdown. r=nika
There's a race between `ProcessWatcher` checking if the fork server is
in use (via `ForkServiceChild::Get`) and the fork server shutdown path
(`ForkServerLauncher::Observe` calling `StopForkServer`).  The race
seems to be benign, but it causes test failures under TSan.

As a relatively simple fix, this patch changes `ProcessWatcher` to check
an atomic flag which is true if the fork server has ever been run.
(This also means that, in the case where the fork server has been shut
down but some of its child processes are still running, we will continue
to use the `kill(pid, 0)` fallback.)

Differential Revision: https://phabricator.services.mozilla.com/D203077
2024-03-02 01:44:38 +00:00
..