From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#23939: Segfault in daemon mode Emacs when detaching an X session Date: Sun, 05 May 2019 00:15:40 -0400 Message-ID: <87k1f5mt8z.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="60858"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: 23939@debbugs.gnu.org To: Doug Gilmore Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 05 06:16:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hN8ZR-000Fk8-87 for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 May 2019 06:16:13 +0200 Original-Received: from localhost ([127.0.0.1]:36136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hN8ZQ-0006QL-8q for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 May 2019 00:16:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hN8ZJ-0006Q8-CI for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 00:16:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hN8ZI-0003AX-4c for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 00:16:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39261) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hN8ZG-00038M-4e for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 00:16:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hN8ZF-0007tY-Rk for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 00:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 May 2019 04:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23939 X-GNU-PR-Package: emacs Original-Received: via spool by 23939-submit@debbugs.gnu.org id=B23939.155702975129740 (code B ref 23939); Sun, 05 May 2019 04:16:01 +0000 Original-Received: (at 23939) by debbugs.gnu.org; 5 May 2019 04:15:51 +0000 Original-Received: from localhost ([127.0.0.1]:52805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hN8Z4-0007j9-SQ for submit@debbugs.gnu.org; Sun, 05 May 2019 00:15:51 -0400 Original-Received: from mail-qt1-f175.google.com ([209.85.160.175]:44713) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hN8Z2-0007bz-8w; Sun, 05 May 2019 00:15:48 -0400 Original-Received: by mail-qt1-f175.google.com with SMTP id f24so775629qtk.11; Sat, 04 May 2019 21:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=aRxMixoPZRd6cLOLkyHPKApL58sCEM/hMkEEI9zDtbw=; b=CGrAZ8gLK0a/mtU6rFev5qMHVYtcMCSUEwe7oG3M5+tYvAZLnTAqRGL9L/ZzR+XhxE cilSvuLAdCU9L39aY/QQQLKR8n2trV1ieDdBjksDrwP/5/iwNaIbjZfsWvHPIsMzNG0z GAAtrmdtYthbGDQgIELvcESe8yO5R3Y+pisBVjOe1GzUSnyM1NEpXkhrnEA07t1elKUD vuX+hXhHcA1bKVTQ0Ry+dW6rFY5iaT3dgs41xagThDplEi5sftnrLPUKbRGxTkQtQbYm 2wxJK8D2r7vlJoxbVpOTLY7Q/+r5iw69bQ4eb8GlG7/W8n5ID0Ry0IDrY8H5R204dflu L4xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=aRxMixoPZRd6cLOLkyHPKApL58sCEM/hMkEEI9zDtbw=; b=HAJ4T+N2F0TXB4JX3wE0c2+jfHyAd2qjDEZLvEEjdTZSCOLROn+GCah2Jlsw5yvs+k agSyFaHg66EYfpbLIPLx4KoePGRxEUeCHR1EzuPepFz+v34NsQa+LgURbzeCZssfE84D Au25W5/09KQDXjehvF8DJfZnWOU1FEcaCY5cZGhzyI7wf9S+nJI3k/AG5CJwY6glHFKu u5Bmm6xJRhw77OWbrmLu/MPEUsqPgWGILnqfwvMTsipWhYsAhk7z+KOL3cl6QdLDsqNe 3W5e6sy+MfBxzUCLFTKFlWicmMgFkLcPrvq6JB0rrVkx8G/4sNqNEJHNZv3qgACjacKC jNRg== X-Gm-Message-State: APjAAAUpTB5RDcOt2tY/gMVWPCsNIFmIQolY7UvufEYYvTQ+2+bE6Zmj ypQ8SWeeZbovEhqAaQbVF+0AEhN0 X-Google-Smtp-Source: APXvYqxmd5paigikVWTWZH3z7AP6Womrbhx6lsVAXLE5Cvmj6aKBP9nRs4uVEmKyMtymJ5hiydedZw== X-Received: by 2002:a0c:c192:: with SMTP id n18mr724554qvh.203.1557029742572; Sat, 04 May 2019 21:15:42 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id m31sm4547919qtm.46.2019.05.04.21.15.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 May 2019 21:15:41 -0700 (PDT) In-Reply-To: (Doug Gilmore's message of "Sun, 10 Jul 2016 17:00:49 -0700") 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: 209.51.188.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:158775 Archived-At: #14958 = emacs --daemon crashing when X-frames are removed ungracefully #11676 = Daemon crashes when ssh dies #22174 = emacs --daemon crashes when ssh is disconnected. I am using lucid x toolkit. merge 14958 11676 22174 #11639 = 24.0.95; Emacs daemon hangs when emacsclient was killed # probably the GTK thing merge 11639 8501 quit Doug Gilmore writes: > I have been running my own build of Emacs 24.2 for quite a while in > daemon mode for quite a while without any problems except that the > daemon would on rare occasions crash when I detached a windows frame > via the delete-frame Emacs command. The other day this happened > several times in succession when connecting to a daemon running on > another host and I was able to catch the failure under an attached gdb > session. I attached a backtrace and a prototype fix. > > I have been building my own Emacs on Ubuntu-12/14 configured with the > --with-x-toolkit=lucid option, so this is not a Gtk issue. > > Has anyone else been seeing this problem? There are some other reports about Emacs daemon dying when closing X sessions, but the backtraces look different, so I guess it's not the same problem. > #0 x_uncatch_errors () at /scratch/dgilmore/emacs-24.2/src/xterm.c:7672 > #1 0x00000000004cb588 in x_catch_errors_unwind (dummy=) at /scratch/dgilmore/emacs-24.2/src/xselect.c:546 > #2 0x000000000055b4ce in unbind_to (count=, value=11872738) at /scratch/dgilmore/emacs-24.2/src/eval.c:3433 > #3 0x000000000055b6e5 in unwind_to_catch (catch=0x7ffc44910f60, value=) at /scratch/dgilmore/emacs-24.2/src/eval.c:1314 > #4 0x000000000055d5a9 in Fsignal (error_symbol=11924850, data=38401462) at /scratch/dgilmore/emacs-24.2/src/eval.c:1764 > (gdb) p x_error_message > $1 = (struct x_error_message_stack *) 0x0 > Subject: [PATCH] Make sure x_error_message is not NULL. > > Before dereferencing the pointer. > @@ -7665,6 +7665,14 @@ x_uncatch_errors (void) > { > struct x_error_message_stack *tmp; > > + /* In rare situations when running Emacs run in daemon mode, > + shutting down an emacsclient via delete-frame can cause > + x_uncatch_errors to be called when x_error_message is set to > + NULL. */ > + > + if (x_error_message == NULL) > + return; > + If this really is possible, I guess a NULL check wouldn't be a bad thing...