Subject: bug#17561: Emacs can forget processes

From: Paul Eggert <[email-masked]>
Date: Tue, 27 May 2014 14:42:03 -0700

On 05/27/2014 11:27 AM, Jorgen Schaefer wrote:
> Should that be ac_cv_func_vfork_works=no?

Yes, thanks for fixing the typo in my earlier message.

> The strace is from an OpenVZ virtual host

Perhaps OpenVZ is contributing to the problem?  There are or were 
relevant bugs in its implementation of vfork; e.g., see 
<http://lkml.org/lkml/2012/5/31/364>.

> I have no[w] recompiled Emacs
> with the latter change, and it's using clone(2) to execute processes,
> which sounds right. I haven't been able to reproduce the bug so far

So far, so good anyway.  That's the good news.  However, some bad news: 
on some platforms strace is reportedly buggy in this area, and can cause 
vfork to misbehave even if vfork works correctly when it's not being 
straced.  Please see <http://www.openwall.com/lists/musl/2013/02/03/3>.

If we have found the problem, I'd like to modify Emacs to avoid the 
kernel bug.  Let's start by trying to build a dynamic test for it. Can 
you please build and run the attached program, and see whether you can 
get it to output the message "vfork bug detected" on your platform?  
Please compile it with the same compiler and flags that you use to 
compile Emacs.  You may need to invoke the test program with arguments, 
e.g., "./a.out 100 10000" to try the test 100 times with a delay of 
10,000 nanoseconds.  The goal is to detect the vfork bug as quickly as 
possible, so if you can detect it it'd be nice to see how small we can 
make the delay.  You might also try to run the test program under strace 
to see whether that changes things. Thanks.