From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <63D874CF-2E2D-4A64-8E22-FE3BE3976A77@univie.ac.at> <3AEBE1EB-D68D-4B24-97F5-5291550F810F@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1463606245 25279 80.91.229.3 (18 May 2016 21:17:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 May 2016 21:17:25 +0000 (UTC) Cc: 22008@debbugs.gnu.org, konrad.podczeck@univie.ac.at To: David Reitter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 18 23:17:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b38qB-0006YI-UM for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 May 2016 23:17:16 +0200 Original-Received: from localhost ([::1]:47115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b38qB-0002tV-2m for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 May 2016 17:17:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b38q4-0002sZ-Ra for bug-gnu-emacs@gnu.org; Wed, 18 May 2016 17:17:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b38py-0002zx-V4 for bug-gnu-emacs@gnu.org; Wed, 18 May 2016 17:17:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b38py-0002zr-QG for bug-gnu-emacs@gnu.org; Wed, 18 May 2016 17:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b38py-00069F-Gg for bug-gnu-emacs@gnu.org; Wed, 18 May 2016 17:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 May 2016 21:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22008 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22008-submit@debbugs.gnu.org id=B22008.146360620223587 (code B ref 22008); Wed, 18 May 2016 21:17:02 +0000 Original-Received: (at 22008) by debbugs.gnu.org; 18 May 2016 21:16:42 +0000 Original-Received: from localhost ([127.0.0.1]:57366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b38pe-00068N-D5 for submit@debbugs.gnu.org; Wed, 18 May 2016 17:16:42 -0400 Original-Received: from mail-wm0-f48.google.com ([74.125.82.48]:38123) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b38pd-000689-C4 for 22008@debbugs.gnu.org; Wed, 18 May 2016 17:16:41 -0400 Original-Received: by mail-wm0-f48.google.com with SMTP id n129so7831934wmn.1 for <22008@debbugs.gnu.org>; Wed, 18 May 2016 14:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=TwsbRFiuKi8mFdNjzD3fgRP8iNTv3GXQ7pEqDzJN5L4=; b=kIOUlfEwwXj/Ce6F06Y1j6fhGSP7WySV77jT+niTPyEd7Mn6ZKkT1ncNOeetuH3dSV OzJjfZOYeJc7dbDxXJYvbjWJESIwOEq2ch5e53+9eHJGelBBx5L02F8+aKATbdSHK+NB TuFL6ZMov7xFQEk9L0NgHkbohdpjtB/OGSeczvKoXN0UqLRdAZrlt2TxSma/7SQ0vuV5 0kmNKufuY+uYCdneaOjlI7s7rhu2Q4isfyzeGAw9HaEYhNEpg0+1PilOmo2JbiE0suR9 Guev1p8hTbHPgrOIcaESAwy2PjVDm9yiQxTIC3ma0uqk0WQQwn42jhAFO15Gw4hfMutW 7V7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=TwsbRFiuKi8mFdNjzD3fgRP8iNTv3GXQ7pEqDzJN5L4=; b=cQe2dpffMLP0XslyYW2rwkbtILq2BV8T5a5y45GRL27MfVCn1QVbK19otCvGT+5dwt OiNJccGqj1HC/wpbbz+b2VpXAkcnB2axj16+HYrZmi+3Co0qSn4tf6pyzaYsuoOjx+9/ 9ayBRFV9R7wwmaxlLSawOY6Nm3+GYPTumg+Xy3UmnSbQHaEdu74PVe/YCDzbTZ03mjkU ve1XIa+YZ0Dzg9YuAZ901R1rsJWjVoL9bISB+lhhYxNEMR7iIJ7NKSYgQUl4yxCBsSeE YK+1ZuIT4JQOa3wlQYPNPj6D5spZB4CBpR/4KKYHxmI0mTkPXDAsDbPMSZSFKkY3nxSY zhyQ== X-Gm-Message-State: AOPr4FV39Kz8bhxdaM6SKecxkC/17VksUXr1NqLrJoztsKB/VlIGGiBQ1J2Mvc3xFObOYw== X-Received: by 10.194.242.65 with SMTP id wo1mr9421723wjc.54.1463606195829; Wed, 18 May 2016 14:16:35 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-2873-0d96-ee2f-d85f.holly.idiocy.org. [2001:8b0:3f8:8129:2873:d96:ee2f:d85f]) by smtp.gmail.com with ESMTPSA id n66sm11145686wmn.7.2016.05.18.14.16.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 May 2016 14:16:34 -0700 (PDT) In-Reply-To: <3AEBE1EB-D68D-4B24-97F5-5291550F810F@gmail.com> (David Reitter's message of "Tue, 24 Nov 2015 21:27:14 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (darwin) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118426 Archived-At: David Reitter 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=20 > > (start-process "em2" nil=20 > (car command-line-args) "-q") > > Then, in the child emacs, make sure we=E2=80=99re doing something in > kill-emacs-hook so we don=E2=80=99t quit immediately: > > (setq kill-emacs-hook '((lambda () (sit-for 1)))) > > Now, in the parent process, do=20 > > (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=E2=80=99s happening, I think that the child is sent a SIG= HUP > 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 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 !=3D 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. --=20 Alan Third