On 09/06/2015 20:17, Olivier Brunel wrote:
+ if (pids.s) sig_block(SIGCHLD) ; (...) + sig_unblock(SIGCHLD) ;
Gah. Of course that's it - the noob mistake of looping around fork() without blocking SIGCHLD. That's so, so bad - I'm really ashamed. :( That's what happens when you rely on selfpipes all the time: you forget how to properly deal with signals without them! I did some tests after changing the final waiting logic to sig_pause(), and didn't get any errors, so I figured it was good - but it obviously wasn't. Thanks for the report and the fix! Applied in current git, new release soonish. I'll still keep the sig_pause() part: it's actually more ad-hoc work to remove the signal handler and enter a blocking wait() loop than to simply let the signal handler do its job until there's nothing left. I find the latter more elegant, even if it didn't work as a fix for the race condition. -- Laurent
