init not processing SIGCHLD during reboot?

Paul Smith psmith at netezza.com
Mon Dec 4 19:51:42 UTC 2006


On Thu, 2006-11-30 at 00:44 +0100, Denis Vlasenko wrote:
> On Wednesday 29 November 2006 19:35, Paul Smith wrote:

> > I'm having a problem where init is not handling SIGCHLD while it's
> > running my shutdown scripts when I type 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.
> > 
> Please try it, and send a patch.

Hi all.  Please find a patch enclosed that resolves this behavior for
me.  This is against the latest SVN as of this morning.

2006-12-04  Paul Smith  <psmith at netezza.com>

	During shutdown init does not reap children while it's waiting
	for a command to finish.  This leaves processes killed by
	commands as zombies, which fools pidof and other methods of
	determining whether a process died or not.

	* init/init.c (waitfor): Add a new argument specifying whether
	we should wait for just the PID of the child, or wait for any
	child.  If the latter, use -1 as the pid in waitpid(2).
	(run): These calls to waitfor() wait for a specific pid.
	(run_actions): For SHUTDOWN, CTLALTDEL, and RESTART actions we
	wait for any PID.  For SYSINIT and WAIT we wait for the
	specific PID of the command we run (as before).

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <psmith at netezza.com>                       http://netezza.com
 "Please remain calm--I may be mad, but I am a professional."--Mad Scientist
-----------------------------------------------------------------------------
      These are my opinions--Netezza takes no responsibility for them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reap-init.patch
Type: text/x-patch
Size: 2118 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20061204/f613b38c/attachment-0002.bin 


More information about the busybox mailing list