all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: David Reitter <david.reitter@gmail.com>
Cc: 22008@debbugs.gnu.org, konrad.podczeck@univie.ac.at
Subject: bug#22008: 25.1; crash: kill-emacs does not wait for child processes to terminate
Date: Wed, 18 May 2016 22:16:33 +0100	[thread overview]
Message-ID: <m28tz75aoe.fsf@breton.holly.idiocy.org> (raw)
In-Reply-To: <3AEBE1EB-D68D-4B24-97F5-5291550F810F@gmail.com> (David Reitter's message of "Tue, 24 Nov 2015 21:27:14 -0500")

David Reitter <david.reitter@gmail.com> writes:

> The bug report below led me to reproduce the situation roughly with
> the following steps:
>
>
> Emacs -Q   (25.1 branch)
>
> Start a second emacs with 
>
> 	(start-process "em2" nil 
> 		       (car command-line-args) "-q")
>
> Then, in the child emacs, make sure we’re doing something in
> kill-emacs-hook so we don’t quit immediately:
>
> 	(setq kill-emacs-hook '((lambda () (sit-for 1))))
>
> Now, in the parent process, do 
>
> 	(kill-emacs)
>
> and answer the kill-the-process? question with yes.
>
> On my system that reliably leads to the crash that Konrad describes
> below. OS X 10.11.
>
> Looking at what’s happening, I think that the child is sent a SIGHUP
> in kill_buffer_processes(), and that we do not wait for the child to
> finish. The system then terminates the child prematurely.

I think this is actually simpler. Just sending a SIGHUP to Emacs causes
essentially the same crash:

    kill -hup <emacs pid>

You don't need to bother with nesting Emacs within Emacs.

It looks like this bit of code in nsterm.m -> ns_read_socket fires
emacs_abort (line 4122):

    if (++apploopnr != 1)
      {
        emacs_abort ();
      }

which then sends SIGABRT which basically just kills Emacs on the spot,
as you'd expect.

I don't know why emacs_abort gets called here, I don't understand this
bit of the code. Perhaps it's intentional, but I'd imagine you'd want
Emacs to quit cleanly on hang-up rather than just abort.
-- 
Alan Third





      reply	other threads:[~2016-05-18 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <63D874CF-2E2D-4A64-8E22-FE3BE3976A77@univie.ac.at>
2015-11-25  2:27 ` bug#22008: 25.1; crash: kill-emacs does not wait for child processes to terminate David Reitter
2016-05-18 21:16   ` Alan Third [this message]

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=m28tz75aoe.fsf@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=22008@debbugs.gnu.org \
    --cc=david.reitter@gmail.com \
    --cc=konrad.podczeck@univie.ac.at \
    /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.