inotifyd problems

Denys Vlasenko vda.linux at googlemail.com
Fri Nov 14 13:44:25 PST 2008


On Friday 14 November 2008 21:58, Vladimir Dronnikov wrote:
> > 1. Every time my agent script runs, a new zombie process is left behind.
> > The same script runs cleanly with a cron program. (this is not the busybox
> > cron).
> >
> 
> A zombie is a terminated process which is not wait()ed by its parent.
> inotifyd spawns the helper and continues to listen to events.
> It is intended.

You need to say so in help text. Moreover, some users won't like it.
They might want to get these events in a serialized fashion.
Please read on.

> Otherwise, event reporting would be blocked until the helper is 
> done. This is how cronds work. Don't mind, init should rip zombies from time
> to time.

No. init should reap zombies *only if parent process has died*.
Otherwise, how would init know that this particular zombie
is not interesting for the parent anymore? After 1 second
of it being a zombie? Or 55 minutes?

You must dispose of your own zombies, or set SIGCHLD to SIG_IGN.
(the second is a semi-official Linux extension, at least
old standards were notoriously under-specified about it.
For example, can you waitfor() a child if you set SIGCHLD to SIG_IGN?
In Linux, you can't).

Setting SIGCHLD to SIG_IGN would make inotifyd to fire-and-forget
the agent. Setting SIGCHLD to SIG_DFL (or just hoping that it is set
this way at the start) and waiting for agent to exit will
serialize events. Both may be useful for different users.

For now I am making inotifyd wait for children:

http://busybox.net/downloads/fixes-1.13.0/busybox-1.13.0-inotify.patch

but I think we maybe need a run-time inotify option
to select which one do we want.

Your opinion guys?
--
vda


More information about the busybox mailing list