From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66151: 29.1.50; daemon crashing after X forwarding disconnects Date: Wed, 10 Apr 2024 10:02:06 +0800 Message-ID: <87jzl63rhd.fsf@yahoo.com> References: Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37998"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66151@debbugs.gnu.org To: George P Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 10 04:03:26 2024 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 1ruNJ8-0009ie-CB for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Apr 2024 04:03:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruNIg-0006iu-4Y; Tue, 09 Apr 2024 22:02:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruNIc-0006iU-De for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2024 22:02:54 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruNIc-00088S-4g for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2024 22:02:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ruNIk-0006fP-7a for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2024 22:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Apr 2024 02:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66151 X-GNU-PR-Package: emacs Original-Received: via spool by 66151-submit@debbugs.gnu.org id=B66151.171271455725525 (code B ref 66151); Wed, 10 Apr 2024 02:03:02 +0000 Original-Received: (at 66151) by debbugs.gnu.org; 10 Apr 2024 02:02:37 +0000 Original-Received: from localhost ([127.0.0.1]:51833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruNIK-0006dd-WD for submit@debbugs.gnu.org; Tue, 09 Apr 2024 22:02:37 -0400 Original-Received: from sonic312-25.consmr.mail.ne1.yahoo.com ([66.163.191.206]:45766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruNII-0006d6-8q for 66151@debbugs.gnu.org; Tue, 09 Apr 2024 22:02:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1712714539; bh=JysV2V0IAqCRilLyWQyhYW2qwOr/fxRMzYquW/VLWBU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=YrXLCSTKb7UBLuQWTfBlTDf+GsiCRGcqykGJNVOuIXVfRn24OxXb1C9rAD+ka0s/JGpB4WgSgdvKtWD42HrWVtxvntwL1Pk3Uv5BOR6slgbpwjTgZ/HWsQ2N96riG5O9uO3aL5rdExe59ZbTweLBaaUUEt7iML05jYEOv15qmkMwXArJzwPrI48Kniqasm2zC43oa26yFf6xbWsBEsh1KDL9JDMCE43SD6ibh2WXI9UOJ+93NbBtGtq40IIl2ZodDzg+qYJpkw+4ZajabcaM7jZwT26xE7dygvHi2ZaxHo72wM7Q/hebqzwMf8rb/T8qYOkXpXQo70LZJhqC4mKFMg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1712714539; bh=azA/Q09O7KHZj4dsVggLg98H8MBZxaCRHKDIbsSo+zv=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=t+aluvJrIyF43W8YVDHInn+I4tnJFuaA1MhYzW8FLGkMKdH725YH2kwVRQXnJgVM7fFmTVDgUWujw1dS78bmczXi0DEGuimvuwZO1yuSbENPfSxi5I9YVsLYYX/PLitWr+VEpZeIzmkxZOjRkK6U7y/29csFX/FCihMVSuYw9gUuIQKtgqDZkNw3tTgFY+gJuZsRqas8stOwFUh2dcfzdeeFcf/wxXmkrv4Q6TwWIlDg8/xFrIsSwURTxarY5KxmarIe64cQP9hdF1SXDbw9FzWN66MEcXOH104RyVcICORa29z6tDBVo7c72rFOUsBnEfqTspFE7uXSsnKyUe3ftw== X-YMail-OSG: jJ_Q_74VM1nmqCHmVfhkVON1OV96w2MB_XEgNwV.vFjwQiCHZkYOL98A95A4EYa CFx22Mi8NBQkE.C8ISKItERro9tuapyWChlB8jTZyHQGgIeLQU2ayhy3KWUvhNN89y2SvojnaBVm R.S.bkMyNyXWKPZs9KkpmuQ48tPUpug73fN1A_.JwAMqYQ0aURRaB6PgHN99ys_BU1lgu1wXerZI WBrV4xH6DihZMsj52JEeICA8jYhBeiGEYbnBLQzij42pRLIjPkl9n1xCnSvHrzpLLFVHL8f0A2Yb cC3A8wRshkqUCXXxBBPYFgXZryZp5lDpP6k9teTmwD9uZ.aVNcJGeBAjHchfOfWjroYuFSGbIA9O .0xAEUUkQiZ_leFvTF2ak0liIgCA_vkl3W5hvIgf.9JhGZEg2jXxuyTB5ZRw38z3NfZsA50CQvZP K.zQlaigGtZKEpeNBp6T1K8NmeZXMMRIpskcRz.BpDb1vX2VP9ZqHbQGQQ8QWQGFpKSDRi83.PtE XpdP4gPQnFpV4vpScE1mXYOCZBr6yOhXfeeIov1DxyWcwqEToecEgut8DwVYvTIN3isiXvLE_4nI L0HeGY7a.KhMeeTn4yZFrIoEYEOCxOkaDxgxTjeAexBDmEDs4Kj_u0h9FHEJephCM6gSBIiQm1eC wqlQRJfJzMOwpR5_OxqS_pDvg25rVzF8m.WfWM.pP4cyV7O.YqTp39nmlNlgc.fHxhU243W0dSyM 7nvoLxaW2o.Eiz10iXZsOjcjIdCaz7dpGNCq4t7G7XvX3TGXRW3TXAy9fX_.7D0PoH3ZpJEy6eB2 QYalm0pvBjEp4RJUEt64lzW01bCLv_mMUl3egsgZcS X-Sonic-MF: X-Sonic-ID: 3741bc16-e791-4d63-a4c3-056d2dd1cb55 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Wed, 10 Apr 2024 02:02:19 +0000 Original-Received: by hermes--production-sg3-6dc75bc8fb-r5vvk (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 7e491ea998574deed835d53097993a3e; Wed, 10 Apr 2024 02:02:12 +0000 (UTC) In-Reply-To: (George P.'s message of "Tue, 9 Apr 2024 12:28:03 -0500") X-Mailer: WebService/1.1.22205 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283021 Archived-At: George P writes: > Hi, > > I am able to reproduce this bug without launching a new emacsclient. > Steps to reproduce: > > - Start emacs daemon. > - Connect using emacsclient -c. > - Connect remotely to the daemon and run another emacsclient -c using > X forwarding. > - Crash the X forwarding connection created in the previous step. > - Go back to the emacsclient running locally on the daemon and run > (set-fontset-font t '(#xe000 . #xf8ff) "Symbols Nerd Font Mono") > > The reason that Ben was seeing a crash with a new emacsclient is > because he is using Doom (an Emacs framework) that attached a function > to server-after-make-hook that called set-fontset-font in the above > way. As Eli said, there is really no good reason to run such a hook > after the first frame, and this behavior has been fixed in Doom. (To > Ben: try upgrading Doom and see if it fixes your issue, if not let me > know!) > > Surprisingly, the segfault still happens even if I explicitly call > delete-frame on the dead frame before calling set-fontset-font. Also, > I am unable to reproduce this bug without Doom (i.e. launching the > daemon with -Q). > > I am confused as to why emacs doesn't automatically clean up frames > that have been disconnected like this. If emacs survives a crash of > the X server, it should be able to identify that the display is dead > (e.g. by checking the validity of output_data.x) and remove it from > the (frame-list), preventing any subsequent commands from acting on > these frames. It has to do something more than what delete-frame does, > as that does not fix the issue (even though it removes the frame from > the (frame-list)). > > Note: using GTK is very different, as emacs crashes *without* having > to run set-fontset-font (i.e. emacs crashes when the X forwarding > connection crashes). With lucid, emacs continues to run fine with the > exception of this bug for me. I cannot reproduce this crash, but I suspect the culprit is to be found in the retention of the remote frame beyond the destruction of the X server connection, which is not detected when Emacs returns to the event loop, and remains unnoticed until set-fontset-font prompts a request to be issued that flushes the now-destroyed connection. Whatever code issues this request is not robust against abrupt destruction of frames by the IO error handler and consequently crashes attempting to dereference the dead frame. Please attach GDB to the running Emacs daemon and post a backtrace from such a crash--with any luck, the code responsible will be rather pathological and easily addressable.