SIGCHLD not received

Denis Bilenko denis.bilenko at
Tue May 29 19:58:03 CEST 2012

On Tue, May 29, 2012 at 7:12 PM, Marc Lehmann <schmorp at> wrote:
> This one - your test program forks after initialising the default loop,
> without calling ev_default_fork.

OK, I've fixed the test program to do that and also fixed a fd leak.
It takes a bit longer to fail now, but it still fails.

> I added an ev_loop_destroy (EV_DEFAULT) at the end of test_main, and got a
> lot longer output, until:
> (libev) error creating signal/async pipe: Too many open files

With fd leak fixed, this should no longer happen. I've tried adding
ev_loop_destroy too - it still fails.

> Note that this only works because the fork isn't done while the default
> loop exists at the time - if you would fork while the dfeault loop
> existed, you'd have to work with ev_default_fork and probably stop all
> watchers you inherited form the parent.

At the time of fork there no active watchers in the test program.

> Now, the fork business is very unfortunate, but both epoll/kqueue and
> pthreads have diminished fork into a state where using an event loop in
> both parent ands child has become extreely hard (actually, doing anything
> in the child is hard with pthreads).

To rule out epoll issues, I'm now using EVBACKEND_SELECT explicitly -
still fails. There no pthreads either, so it has to be something else.

Attached is modified version with all the fixes mentioned above.
Please try it as well :) I've also tried using EVFLAG_FORKCHECK but
that did not help either.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsigchld1.c
Type: text/x-csrc
Size: 1384 bytes
Desc: not available
URL: <>

More information about the libev mailing list