all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: George P <georgepanagopo@gmail.com>
Cc: 66151@debbugs.gnu.org
Subject: bug#66151: 29.1.50; daemon crashing after X forwarding disconnects
Date: Wed, 10 Apr 2024 10:02:06 +0800	[thread overview]
Message-ID: <87jzl63rhd.fsf@yahoo.com> (raw)
In-Reply-To: <CAGcjMxnt2aEGq8Pp39ep-0K7FKxm2dvExVmDgV32c3+GZ6nuFw@mail.gmail.com> (George P.'s message of "Tue, 9 Apr 2024 12:28:03 -0500")

George P <georgepanagopo@gmail.com> 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.





  reply	other threads:[~2024-04-10  2:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 10:22 bug#66151: 29.1.50; daemon crashing after X forwarding disconnects Benjamin Schwehn
2023-09-22 12:22 ` Eli Zaretskii
2023-09-22 13:12   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-22 13:16     ` Eli Zaretskii
2023-09-22 14:28       ` Benjamin Schwehn
2023-09-22 15:07         ` Eli Zaretskii
2023-09-22 16:51           ` Benjamin Schwehn
2023-09-22 23:42             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-09 15:02 ` bug#66151: George P
2024-04-09 15:16 ` bug#66151: 29.1.50; daemon crashing after X forwarding disconnects George P
2024-04-09 17:28   ` George P
2024-04-10  2:02     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-10 15:42       ` George P
2024-04-11  0:50         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-12  2:03           ` George P
2024-04-13  1:51             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13  7:46               ` George P
2024-04-13 11:45                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13 17:56                   ` George P
2024-04-18 10:40                     ` Eli Zaretskii
2024-04-19  9:07                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-19 11:15                         ` Eli Zaretskii
2024-04-19 12:00                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-27  8:37                             ` Eli Zaretskii
2024-05-05 16:25                               ` George P
2024-05-06 11:02                                 ` Eli Zaretskii
2024-05-07  0:49                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-09 20:36 ` George P
2024-05-07 20:26   ` Benjamin Schwehn

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=87jzl63rhd.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=66151@debbugs.gnu.org \
    --cc=georgepanagopo@gmail.com \
    --cc=luangruo@yahoo.com \
    /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.