> Just came across a really thorny problem with our implementation of
> qmail-queue.

Is this a new bug?

> Basic summary is that we have a potential race condition between calls
> to waitpid() in the parent process and in qmail-queue. If the parent
> process' waitpid(-1) call enters before the child processes
> waitpid($child) does then the parent ends up collecting the zombie,
> and the child never sees the qmail-queue exiting, and thus hangs
> indefinitely.
> 
> Anyone have any thoughts on how to solve this? Can you tell waitpid()
> to only operate on child processes and not grandchild processes?

No, but you can tell it to only wait for a specific pid.  But that
won't help in this case.

I don't remember waitpid ever detecting grandchild processes.  It
shouldn't be.

       The value of pid can be one of:

       < -1   which means to wait for any child process whose  process  group
              ID is equal to the absolute value of pid.

       -1     which  means  to  wait  for any child process; this is the same
              behaviour which wait exhibits.

       0      which means to wait for any child process whose  process  group
              ID is equal to that of the calling process.

       > 0    which  means to wait for the child whose process ID is equal to
              the value of pid.



Reply via email to