ProcessReaper: single thread reaper

Martin Buchholz martinrb at google.com
Wed Apr 16 19:15:17 UTC 2014


On Mon, Apr 14, 2014 at 1:57 PM, Peter Levart <peter.levart at gmail.com>wrote:

>
> There's already such a race in current implementation of
> Process.terminate(). It admittedly only concerns a small window between
> process exiting and the reaper thread managing to signal this state to the
> other threads wishing to terminate it at the same time, so it could happen
> that a KILL/TERM signal is sent to an already deceased PID which was
> re-used, but it doesn't happen in practice since PIDs are not re-used very
> soon typically.
>
> But I agree, waiting between listing children and sending them signals
> increases the chance of hitting a reused PID.
>

We do rely on the OS not reusing a PID _immediately_.  We used to have bugs
in this area where Process.destroy would send a signal to a pid that may
have deceased arbitrarily long ago.



More information about the core-libs-dev mailing list