From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56528: 29.0.50; Emacs lucid segfaults when X dies Date: Wed, 13 Jul 2022 20:11:41 +0300 Message-ID: <83v8s1uecy.fsf@gnu.org> References: <877d4h1vl9.fsf@astatine.mail-host-address-is-not-set> <87ilo1uw9d.fsf@yahoo.com> <87sfn5l1c9.fsf@gmail.com> <87cze9urzv.fsf@yahoo.com> <877d4hi2lx.fsf@gmail.com> <831qupw3us.fsf@gnu.org> <87r12pgn80.fsf@gmail.com> <83zghdunq1.fsf@gnu.org> <87mtddgkp9.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33241"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 56528@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 13 19:12:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBfuE-0008US-9b for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Jul 2022 19:12:10 +0200 Original-Received: from localhost ([::1]:46986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBfuC-00060I-PP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Jul 2022 13:12:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBfu6-000609-V2 for bug-gnu-emacs@gnu.org; Wed, 13 Jul 2022 13:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBfu6-0002yQ-Iu for bug-gnu-emacs@gnu.org; Wed, 13 Jul 2022 13:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oBfu6-0001t2-5Y for bug-gnu-emacs@gnu.org; Wed, 13 Jul 2022 13:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Jul 2022 17:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56528 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 56528-submit@debbugs.gnu.org id=B56528.16577323207243 (code B ref 56528); Wed, 13 Jul 2022 17:12:02 +0000 Original-Received: (at 56528) by debbugs.gnu.org; 13 Jul 2022 17:12:00 +0000 Original-Received: from localhost ([127.0.0.1]:47643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oBfu3-0001sl-Gz for submit@debbugs.gnu.org; Wed, 13 Jul 2022 13:11:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oBftz-0001sS-Jr for 56528@debbugs.gnu.org; Wed, 13 Jul 2022 13:11:57 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54728) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBftu-0002xX-DU; Wed, 13 Jul 2022 13:11:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=xtQup4tShX6kGvh8QFPLv3LRXsQ3o6rY8ZnAoqM9jxs=; b=mhChwjXxBIvS Ow7o2oaJOeiTSZXA4YOTvQHWUGfDAYROCEhPzMWWAOnxrmfI4Xlry7LgzOF/bEx65tNj/1hq9uHIQ UPhLNkrXyDY7EK5QFlnaNxcyKYeqo9h+XQgItX6mAHti9GsUxsx63YzJ7FaGuAjMrMoQGs1D5K0r5 JvrDuqvEUWHXy0ZHLn4aPpu3m1DLVEsXJf29F+aazVKMR/2oMchPISPBKwqpSvgNeXYIbSFJ4uwNA Nhyfk7+0sPa/G7zgwH83SySJytOBw81bb4DGarNFUp0w5/ZO4hYYiKYWXob3koybhu7m1SWoAUMfz zUpB1fHiiv7wCkXsHuJVQA==; Original-Received: from [87.69.77.57] (port=2199 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBftt-00047Q-Sw; Wed, 13 Jul 2022 13:11:50 -0400 In-Reply-To: <87mtddgkp9.fsf@gmail.com> (message from Visuwesh on Wed, 13 Jul 2022 19:48:26 +0530) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:236911 Archived-At: > From: Visuwesh > Cc: luangruo@yahoo.com, 56528@debbugs.gnu.org > Date: Wed, 13 Jul 2022 19:48:26 +0530 > > >> > Btw, what do we expect Emacs to do in this scenario? If the X server > >> > is killed, Emacs cannot display anything, so why an abort is not TRT? > >> > What practically interesting use case does this emulate? > >> > >> Emacs is running as a daemon, I expect it to survive the death of X. > > > > "Survive" how? by closing all the frames? > > Unfortunately, I do not start the daemon by M-x server-start RET so I do > not know what the behaviour was here but read below. Starting a daemon automatically starts the server. > > IOW, you are saying that when this happens, Emacs should test whether > > it has a running server, and if it does, unconditionally close all the > > frames? Is that really useful? > > In the past, when I start Emacs daemon by `emacs --daemon' in my > ~/.xsession file and eventually kill X, Emacs will not die. I can still > access the Emacs session in the tty or a fresh Xorg session using > emacsclient. But I seem to recall M-x server-start RET working > identical to --daemon here. That's probably just sheer luck. When you kill the X server, any code in Emacs that tries to display something will crash and burn, because there's generally no way for us to display anything in that case. > >> Emacs dying on me because I killed X is an annoyance since sometimes I > >> need to restart X. > > > > Why not close Emacs before that -- this way you get to keep all your > > edits, instead of relying on error handling to succeed in doing that. > > That's not a solution, sorry. Just saving the buffers is not going to > cut it, I would like to have my shell session, other processes stay > alive. Our solution to this is desktop.el. You can customize it to save and restore more than it does by default. But expecting Emacs to survive the killing of X is unreasonable. > Hmm, trying it with --fg-daemon, sometimes Emacs survives, sometimes it > dies. Backtrace follows, > > (gdb) run -Q --fg-daemon > Starting program: /home/viz/lib/ports/emacs/src/emacs -Q --fg-daemon > [Switching to thread 1 (process 7339)](running) > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". > [New Thread 0x7ffff15fe640 (LWP 7340)] > [New Thread 0x7ffff0c6d640 (LWP 7356)] > [New Thread 0x7fffebfff640 (LWP 7357)] > [Detaching after vfork from child process 7393] > > Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. > message3_nolog (m=...) at xdisp.c:11770 > 11770 if (FRAME_TERMINAL (f)->frame_up_to_date_hook) > (gdb) bt > #0 message3_nolog (m=XIL(0x555556066254)) at xdisp.c:11770 > #1 0x00005555555f3449 in message3 (m=XIL(0x555556066254)) at xdisp.c:11698 > #2 0x0000555555848e28 in Fmessage (nargs=2, args=0x7ffff15ff250) at editfns.c:2881 Here's an excellent example of what I was trying to say: this says that Emacs tried to show some message, and crashed because that requires a valid frame with a terminal connection. What do you expect Emacs to do here? I think we should close this bug as wontfix. It's unreasonable to expect a GUI program to stay in the air when its GUI infrastructure is forcibly killed.