From: Paul Eggert <eggert@cs.ucla.edu>
To: Jorgen Schaefer <forcer@forcix.cx>
Cc: 17561@debbugs.gnu.org
Subject: bug#17561: Emacs can forget processes
Date: Tue, 27 May 2014 14:42:03 -0700 [thread overview]
Message-ID: <538506AB.3090201@cs.ucla.edu> (raw)
In-Reply-To: <20140527202756.7bade0ce@forcix.jorgenschaefer.de>
[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]
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.
[-- Attachment #2: vfork-test.c --]
[-- Type: text/plain, Size: 892 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <sys/select.h>
#include <sys/wait.h>
#include <unistd.h>
int
main (int argc, char **argv)
{
int test_case_count = argc < 2 ? 10000: atoi (argv[1]);
int delay_in_nanoseconds = argc < 3 ? 1000 : atoi (argv[2]);
int i;
for (i = 0; i < test_case_count; i++)
{
pid_t p = vfork ();
int ok = 0;
int volatile child_status = 0;
if (p < 0)
{
perror ("vfork");
return 2;
}
if (p == 0)
{
struct timespec timeout;
timeout.tv_sec = 0;
timeout.tv_nsec = delay_in_nanoseconds;
pselect (0, 0, 0, 0, &timeout, 0);
_exit (child_status);
}
if (p > 0)
{
int status;
child_status = 1;
if (waitpid (p, &status, 0) == p
&& WIFEXITED (status) && status == 0)
ok = 1;
if (!ok)
{
printf ("vfork bug detected\n");
return 1;
}
}
}
return 0;
}
next prev parent reply other threads:[~2014-05-27 21:42 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-23 15:52 bug#17561: 24.4.50; Emacs can forget processes Jorgen Schaefer
2014-05-23 16:28 ` bug#17561: " Paul Eggert
2014-05-23 16:44 ` Jorgen Schaefer
2014-05-24 23:01 ` Paul Eggert
2014-05-25 7:57 ` Jorgen Schaefer
2014-05-26 17:08 ` Paul Eggert
2014-05-26 18:49 ` Jorgen Schaefer
2014-05-26 23:58 ` Paul Eggert
2014-05-27 18:27 ` Jorgen Schaefer
2014-05-27 21:42 ` Paul Eggert [this message]
2014-05-27 22:16 ` Jorgen Schaefer
2014-05-28 0:47 ` Paul Eggert
2014-05-28 20:53 ` Jorgen Schaefer
2014-05-28 23:00 ` Paul Eggert
2014-05-28 23:35 ` Jorgen Schaefer
2014-05-29 1:22 ` Paul Eggert
2014-05-29 10:08 ` Jorgen Schaefer
2014-05-29 23:15 ` Paul Eggert
2014-05-29 4:17 ` Paul Eggert
2014-05-29 11:39 ` Jorgen Schaefer
2014-05-29 15:09 ` Paul Eggert
2014-05-29 15:22 ` Andreas Schwab
2014-05-29 15:26 ` Paul Eggert
2014-05-29 17:03 ` Jorgen Schaefer
2014-05-29 17:55 ` Andreas Schwab
2014-05-29 18:23 ` Jorgen Schaefer
2014-05-29 19:06 ` Jorgen Schaefer
2014-05-29 20:27 ` Andreas Schwab
2014-05-29 19:15 ` Andreas Schwab
2014-05-30 6:07 ` Paul Eggert
2014-05-30 20:41 ` Jorgen Schaefer
2014-05-30 21:29 ` Paul Eggert
2014-05-27 4:05 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=538506AB.3090201@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=17561@debbugs.gnu.org \
--cc=forcer@forcix.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.