Subject: Re: bug#54715: 28.0.92; crash when X server died

From: Po Lu <[email-masked]>
Date: Tue, 05 Apr 2022 09:05:19 +0800

Ken Raeburn <[email-masked]> writes:

> I was in the midst of creating a new Emacs frame (C-x 5 2) when my X
> server (Xwayland) died.  I’ve only been using frames on this one server,
> though it looks like the methods I’m using for creating them may give me
> a mix of $DISPLAY values of :0 and :0.0 in emacs and emacsclient
> invocations, which Emacs may still be treating as different displays and
> thus opening two connections.  This might explain trying to update
> frames on one display when the other goes away.

:0 and :0.0 are different X servers from the point of view of Xlib.
Don't mix up display names like that: it just wastes display
connections.

> I’m using the emacs-lucid-28.0.92-2.fc35.x86_64 package, as packaged up
> at
> https://download.copr.fedorainfracloud.org/results/bhavin192/emacs-pretest/
> , on Fedora 35.  It looks like my use of daemon mode has fallen by the
> wayside somewhere, so losing both displays means the process exits.  I
> had multiple IRC (rcirc) connections open, emacs server enabled, TRAMP
> in use, and at least one interactive shell subprocess on a remote
> machine.
>
> Some notable stack frames:
>  #51: creating a new frame
>  #41: reporting lost connection to display :0
>  #28: reporting lost connection to display :0.0; no frames left, kill emacs
>  #23: calling hooks registered for kill-emacs
>  #18: server-force-stop
>  #14: delete-process calls into redisplay
>  #12: redisplay (SELECTED_FRAME) calls emacs_abort
>  #8:  shut_down_emacs kills processes
>  #7:  delete-process calls into redisplay
>  #5:  redisplay calls emacs_abort

> #28 0x0000000000422866 in x_connection_closed (dpy=dpy@entry=0x511fc50, error_message=error_message@entry=0x7ffde15e78e8 "Connection lost to X server ':0.0'", ioerror=ioerror@entry=true) at ../../src/xterm.c:10240

x_connection_closed binds inhibit-redisplay to t, so redisplay cannot do
anything interesting inside.

> #12 0x00000000004202a3 in redisplay_internal () at ../../src/xdisp.c:15633

But this frame shows that it did try to do something, and aborted.
Unfortunately, I don't see anything interesting at line 15633 in Emacs
28.  Please build without optimizations and try to see exactly what
called emacs_abort.

Thanks.