In local.glasgow-haskell-bugs, you wrote:
> After much study I have a new theory.  It appears that the pipe machinery
> is working fine, but that sometimes my program fails to "reap" all of its
> terminated child processes.  I'm using a `sigCHLD` signal handler that
> does `getAnyProcessStatus True False` each time it's invoked.  It seems
> that one or more `sigCHLD` signals are occurring while an instance of the
> handler is already running (having presumably blocked `sigCHLD` during its
> execution), and hence the "contemporaneous" signals are getting lost.

>From my experience what usually happens is that the signal handler gets
invoked, but before reaching the `getAnyProcessStatus' command for some
reason or other the Haskell scheduler decides to preempt this thread.
If the scheduler then invokes your main program again which maybe makes
a blocking C call, the signal handler -- and of course the not yet
reaped child -- will still be sitting around until it gets the next
chance to run.

Keep your program running for some time if you suspect you might have
the same problem and see if there's always a different set of children
(note the PIDs) waiting. You can insert hello-debugging statements into
the signalhandler, too, to see if it a least gets invoked the correct
number of times.

Perhaps the new threaded RTS might help, too. Also increasing the number
of Haskell thread switches (+RTS -C0) on the command line could be
useful for debugging.
-- 
http://news.bbc.co.uk: `Israeli forces [...], declaring curfews that
confine more than 700,000 people to their homes.'
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to