SIGCHLD not received
schmorp at schmorp.de
Wed May 30 15:33:46 CEST 2012
On Wed, May 30, 2012 at 02:55:52PM +0400, Denis Bilenko <denis.bilenko at gmail.com> wrote:
> Yes, it seems that waitpid() somehow masks or avoids the bug. If I
> apply this small patch to your program it fails - why?
The test program still forks with an existing loop, and when I run it
after the patch I quickly get fork errors in my other terminals, so it's
likely still buggy *somehow*.
Frankly, I don't see the purpose in debugging this program further, it's just
way too buggy to be useful as a test program.
> The recommendations are good - I have found empirically too that
> fork+exec is just more reliable than fork when you use libev loop
There is no difference in reliability with libev or not, and libev is
reliable with both fork and fork+exec. What you found out empirically is
that your test program is very, very buggy, not that fork is less reliable
when you use libev.
My recommendations were to not do it that way, because it is hard. And
not surprisingly, we have found at least four critical bugs in the test
> the parent. However, this particular test program is extracted from
> python-gevent test suite, not a real application. I cannot change it
> much, except to fix bugs in libev usage, like call ev_loop_fork() when
> needed (which original Python program already did - it was lost during
> translation to C).
If you can only fix some bugs in it but not others, then you simply need
to live with the bugs.
> BTW, the original test case did not have an infinite loop, it just
> failed randomly, which suggests that the failure may happen on the first
Well, it was not the only bug in the test program.
> My solution so far has been to add a timer reaping the children
> periodically (attached). But I still have no idea what makes SIGCHLD
> being skipped in the first place.
There is no evidence whatsoever that sigchld has been skipped (or, if it
has been skipped, that this is caused by libev).
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
More information about the libev