unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Vincent Lefevre <vincent@vinc17.net>, 8705@debbugs.gnu.org
Subject: bug#8705: 23.3; Emacs occasionally crashes (segfault) just after starting it
Date: Thu, 09 Oct 2014 16:03:13 -0400	[thread overview]
Message-ID: <a7eguhf1tq.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <jwvsijdya91.fsf-monnier+bug#8705@gnu.org> (Stefan Monnier's message of "Sat, 27 Sep 2014 00:10:18 -0400")

Stefan Monnier wrote:

>> Any news on this bug? Debian's GNU Emacs 24.3.1 is still affected.
>
> Same question here.
 

Comments from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699325#17:


> What emacs appears to be doing is:
> 
> * vfork() in thread A
>   - parent: thread A suspended
>   - parent: threads B, C, ... (one of which is the Gtk GUI) continue
>   - child: "shares all memory with its parent, including the stack"
>     per vfork(2)
> 
> * child copies environ and modifies the copy as needed
> 
> RACE:
> child + parent thread A:
>   * changes the global environ pointer, potentially making it point to
>     a new mmap() that only exists in the child process (or something?)
>   * child: calls execvp()
>   * parent: thread A resumes and puts the old environ back
> parent threads B, C...
>   * threads B, C, ... continue their work and might call getenv()
> 
> If the child wins the race, everything's OK; if the parent's threads B,
> C... "win" the race, everything explodes. It seems that Gtk, in the
> parent's GUI thread, is now more likely to "win" the race and crash,
> because new features like touchscreen support have the side-effect that
> it calls getenv() more often.
> 
> On the upstream emacs bug, Troels Nielsen wrote:
> > In the meantime, retaining support for vfork would be nice, because
> > on some platforms, like Cygwin, fork is still very slow
> 
> but on Linux (and hopefully also *BSD and Hurd), fork() is quite fast,
> and considerably less crashy. I would suggest changing the vfork() call
> to fork(), making sure the environ rewriting is only done in the child
> side of the fork(), and seeing whether that helps.
> 
> Alternatively, emacs could use execvpe() instead of execve() on
> platforms where it exists (including all GNU platforms as far as I
> know), so that it does not need to alter the value of environ at all on
> such platforms. I think that would fix this?





  reply	other threads:[~2014-10-09 20:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20  8:54 bug#8705: 23.3; Emacs occasionally crashes (segfault) just after starting it Vincent Lefevre
2011-05-20  9:12 ` Vincent Lefevre
2011-05-20 10:40 ` Eli Zaretskii
2011-05-20 11:16   ` Vincent Lefevre
2011-05-20 11:38     ` Eli Zaretskii
2011-05-20 12:59       ` Vincent Lefevre
2011-09-20 14:51     ` Vincent Lefevre
2012-07-06 11:13       ` Vincent Lefevre
2012-07-06 20:32         ` Troels Nielsen
2012-07-06 22:51           ` Daniel Colascione
2012-07-07 15:08             ` Troels Nielsen
2014-09-22 13:06 ` Vincent Lefevre
2014-09-27  4:10   ` Stefan Monnier
2014-10-09 20:03     ` Glenn Morris [this message]
2014-10-12  2:40 ` bug#8705: Emacs 24.3 " Paul Eggert
2014-10-12  6:19   ` Paul Eggert
2014-10-14 18:36   ` Stefan Monnier
2014-10-14 18:44     ` Glenn Morris
2014-10-14 18:45       ` Glenn Morris
2014-10-14 18:52       ` Glenn Morris

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a7eguhf1tq.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=8705@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=vincent@vinc17.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).