Subject: Re: bug#66151: 29.1.50; daemon crashing after X forwarding disconnects

From: Eli Zaretskii <[email-masked]>
Date: Fri, 22 Sep 2023 15:22:15 +0300

> From: Benjamin Schwehn <[email-masked]>
> Date: Fri, 22 Sep 2023 12:22:08 +0200
> 
> Hi,
> I have emacs daemon reproducibly crashing in this scenario:
> 
> - emacs running as daemon via systemd user service
> - running "emacsclient -nc" via ssh -X session
> - stop X server on client machine or cut network connection between
>  client and server
> - run emacsclient -nc again
> 
> Result:
> emacs window opens for about a second, then the daemon crashes. The
> daemon then automatically restarts via the systemd service and once it
> is up again, emacsclient works fine again.

Does this happen with any emacsclient command in this situation?  What
if you don't use -c, for example, or use -t instead?

>From this backtrace:

> deliver_thread_signal.constprop.0 at
> /home/ben/install/emacs/emacs/src/sysdep.c:1765
> ?? ??:0
> make_lisp_ptr at /home/ben/install/emacs/emacs/src/lisp.h:1364
>  (inlined by) realize_default_face at
> /home/ben/install/emacs/emacs/src/xfaces.c:5802
>  (inlined by) realize_basic_faces at
> /home/ben/install/emacs/emacs/src/xfaces.c:5736

The segfault seems to be caused by the frame's output_data.x being
NULL or invalid.  Po Lu, is this caused by stopping the server or
cutting the network connection between client and server?  If so, is
there any remedy?  Perhaps the server should exit gracefully in this
case?

Btw, I don't quite understand this part:

> recompute_basic_faces at /home/ben/install/emacs/emacs/src/xfaces.c:682
>  (inlined by) recompute_basic_faces at
> /home/ben/install/emacs/emacs/src/xfaces.c:677
>  (inlined by) free_realized_fontsets at
> /home/ben/install/emacs/emacs/src/fontset.c:1345
> Fset_fontset_font at /home/ben/install/emacs/emacs/src/fontset.c:1696

Why do we need to call set-fontset-font here?  What kind of
emacsclient command line causes this?