[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-proxy-maint
Subject:    Re: [gentoo-proxy-maint] Checking before reinventing wheel: init script not waiting for child proces
From:       Philippe Chaintreuil <gentoo_bugs_peep () parallaxshift ! com>
Date:       2016-06-02 12:09:09
Message-ID: 37c55801-0819-f836-9784-c7527c163272 () parallaxshift ! com
[Download RAW message or body]

On 6/2/2016 3:02 AM, Sam Jorna wrote:
 > On Wed, Jun 01, 2016 at 04:02:12PM -0400, Philippe Chaintreuil wrote:
 >>      I'm looking at a bug [1] that is complaining that an init script
 >> doesn't wait for the child processes of the daemon to exit before it
 >> returns.
 >>
 >>      I just wanted to make sure that there's not a standard/existing
 >> methodology that does this before I start adding custom code.
 >>      I guess I should also make sure that this isn't something the
 >> hive-mind thinks should be punted upstream.  (I've looked at the source
 >> code, and the interrupt handler just loops through the child pids and
 >> exits, it doesn't wait on the pids.)
 >
 > I haven't looked too closely at the code, but does spamd keep track 
of its own
 > children? As in, does the master process wait until the child 
processes are
 > terminated before terminating itself? If so, then perhaps you could 
force the
 > daemon into the foreground and have start-stop-daemon background it 
itself.

     It doesn't wait, it just sends the signal to each child & exits, no 
wait pid.  Here's the interrupt handler [trimmed for relevance]:

====================================================================
sub kill_handler {
   my ($sig) = @_;
   info("spamd: server killed by SIG$sig, shutting down");

      [...]

   $SIG{CHLD} = 'DEFAULT';    # we're going to kill our children
   if ($scaling) {
     $scaling->set_exiting_flag(); # don't start new ones
   }
   my $killsig = am_running_on_windows() ? 'KILL' : 'INT';
   foreach my $pid (keys %children) {
     kill($killsig, $pid)
       or info("spamd: cannot send SIG$killsig to child process [$pid]: 
$!");
   }
   exit 0;
}
====================================================================

                 -- Philippe "Peep" Chaintreuil

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic