[**EXTERNAL**] SV: Re: [PATCH] Fix runsvdir so it reaps children and avoid zombi processes when killed.

Ralf Friedl Ralf.Friedl at online.de
Thu Jan 4 21:39:27 UTC 2018


Cathey, Jim wrote:
> The rule is pretty simple:  If you die, and your parent is still in the process list (regardless of its state), then you're a zombie until your parent reaps you.  If you die and your parent is not in the process list, then init(8) reaps you at its earliest convenience.  If you're a zombie and then your parent dies without reaping you, the kernel adopts you to init(8), who then reaps you at its earliest convenience.  A process ALWAYS has a parent, either its original parent or init(8), and that parent is always responsible for reaping you upon your death.  This is part of the very definition of Unix, and all its descendants.  If this isn't happening, there is a bug in init(8), and/or the kernel.
>
> In no way are you required to reap your own children before death, whether deliberate or accidental, and you never have been.
>
> However, there are no particular time constraints upon this reaping by init(8).  It could be busy doing something, even something as innocuous as logging to a file, that causes a delay.  If your system is designed to require a fast reap somehow, then you must reap your own children.  But that's a particular system issue, not a generic problem.  I could argue that perhaps this is an ill-designed system, if it's relying upon unspecified behavior.
This is true. However creating many children and leaving them as zombies 
consumes resources which will be exhausted at some point, on smaller 
systems sooner.

If you don't intend to wait for the children just set SIGCHLD to ignore 
and you don't have to care about this problem.


More information about the busybox mailing list