SIGCHLD not received

Denis Bilenko denis.bilenko at
Tue Jul 24 10:06:34 CEST 2012

On Mon, Jul 23, 2012 at 1:24 PM, Marc Lehmann <schmorp at> wrote:
> Hmm, it's been a long time - what exactly is the behaviour I am supposed to
> see from the program without the sleep, and what behaviour do you get?

Here's the program with sleep removed (no further changes necessary),
just tested it against libev in CVS:

Actual output:

denis at ubuntu:~/work/libev-cvs$ ./testsigchld5
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.Alarm clock

Expected output:

*. goes on infinitely

>> The source of the issue is a race condition between ev_feed_signal and
>> loop_fork(). If I block signals at the beginning of loop_fork() and
>> unblock them at the end I have it fixed.

> Can you explain the mechanism or nature of that race condition?

in loop_fork() you call

  ev_io_stop (EV_A_ &pipe_w);
  // signal delivered right here

in ev_feed_signal() you check

  if (!ev_active (&pipe_w))

thus ev_feed_signal() handler becomes noop.

>> Do you acknowledge this to be a bug in libev?
> If it is a bug, I will of course acknowledge it - that's a weird question
> to ask(?).

It's a very real question, depending on the answer I either can
continue to use stock libev or have to maintain my own slightly
modified branch, which is a nuisance.

>> Do you need help with fixing it?
> I need help understanding it, to see if it's really a bug - keep in mind
> that you made a lot of invalid reports, and it takes time to sift through
> all and find out if there really is an issue.

Just use the last test program (in this email).

More information about the libev mailing list