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

List:       busybox
Subject:    Re: init not processing SIGCHLD during reboot?
From:       Denis Vlasenko <vda.linux () googlemail ! com>
Date:       2006-11-29 23:44:51
Message-ID: 200611300044.51959.vda.linux () googlemail ! com
[Download RAW message or body]

On Wednesday 29 November 2006 19:35, Paul Smith wrote:
> I'm using a slightly older version of busybox (1.1.2) so if this has
> been fixed in newer versions let me know.
> 
> I'm having a problem where init is not handling SIGCHLD while it's
> running my shutdown scripts when I type reboot.  So I have a line
> in /etc/inittab like:
> 
> ::shutdown:/etc/init.d/system stop
> 
> This script brings down a number of daemons, etc. and it's important
> that they be brought down "sanely" so that they can clean up resources,
> etc. properly (sync up some devices and other things).
> 
> So, I'm using pidof to find their PIDs, and sending them signals with
> kill.  Then I wait a second and do it again.  If I get to a certain time
> and the process has not died yet I do some other processing.
> 
> This works fine if I run that command from the shell, but it fails
> during a real reboot.  Annotating the script I can see that when I kill
> the process it dies, but it's still there as a zombie (Z), so pidof
> still finds it and thinks that it hasn't died yet.
> 
> I'm assuming that while busybox init is running my script, it's not
> handling SIGCHLD signals and cleaning up zombies like it usually does,
> so that's why my process is never reaped.
> 
> 
> Now, of course I could make my script more complex and use ps with awk
> or sed to find the pids of only non-zombie versions of my daemons, but
> it seems like init should not leave zombies around like this.  There are
> a number of options, of course: the simplest one might be to set SIG_IGN
> on SIGCHLD before init starts shutdown processing.  Because we're
> rebooting anyway we don't really need to handle SIGCHLD anymore, and
> SIG_IGN will let the kernel clean up the process immediately.

Please try it, and send a patch.
--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

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