[Freeipa-devel] [PATCH] Make child processes exit when parent dies

Simo Sorce ssorce at redhat.com
Thu Aug 6 09:53:35 UTC 2009


On Wed, 2009-08-05 at 18:25 -0400, Dmitri Pal wrote:
> Jakub Hrozek wrote:
> > The attached patch addresses ticket #84.
> >
> > The implementation is unfortunately Linux-specific as it uses the
> > prctl(2) syscall. Ideas how to accomplish this in a cross-platform
> > manner are welcome.
> >
> >     Jakub
> How do we fork processes?
> If we just fork and do not daemonize then children should just die
> (system sends sigterm to children AFAIR) when the parent process exits.
> At least that is what used to happen in old days on Solaris, HP and AIX.
> If we fork and then make the process a new process group leader by using
> setpgrp() then it terns into a service. It PPID becomes 1 (AFAIR - have
> done it many years ago).
> If our children are independent processes there is no good way other
> than pass in the IP of the parent at the initialization and periodically
> check if the process is still around and its start time is before child's.
> 
> If the problem we are trying to solve is to exit back ends when monitor
> dies we should either keep the children as members of the same group or
> use the periodic check approach.

I have to say I am a bit surprised about this patch too.
Last time I put my hands on it we were using process groups exactly so
that when monitor is killed all other process die as well. In my
experience this works fine in master. In what cases do this fail ?

Simo.





More information about the Freeipa-devel mailing list