Hey Ludo, > Woow, good catch! Thanks :) >> The work-around here is to save the installed SIGTERM handler and reset >> it. Then, after forking, the parent can restore the SIGTERM handler. The >> child will use the default SIGTERM handler that terminates the process. > > OK, makes sense. (Another occasion to see how something like > ‘posix_spawn’ would be more appropriate than fork + exec…) Didn't know about that function, but it seems way easier to manipulate and less error prone indeed! > Shouldn’t it be: > > (let ((pgid (getpgid pid))) > (if (= (getpgid 0) pgid) > (kill pid signal) ;don't kill ourself > (kill (-p pgid) signal))) Yes, I changed it. > Note: Use the most specific comparison procedure, ‘=’ in this case, > because we know we’re dealing with numbers (it enables proper type > checking, better compiler optimizations, etc.). More importantly, ‘eq?’ > performs pointer comparison, so it shouldn’t be used with numbers (in > practice it works with “fixnums” but not with bignums). Ok, noted! >> +# Try to trigger eventual race conditions, when killing a process between fork >> +# and execv calls. >> +for i in {1..50} >> +do >> + $herd restart test3 >> +done > > Would it reproduce the problem well enough? On a slow machine one time out of two, and on a faster machine, never. The 'reproducer' I used, was to add a 'sleep' between fork and exec, it works way better! Tell me if you think its better to drop it. > Could you send an updated patch? Here it is! > Thanks for the bug hunting and for the patch! Thanks for the fast review :) Mathieu