Subject: bug#75629: 30.0.93; restart-emacs does not reliably restart Emacs

From: Daniel Mendler <[email-masked]>
Date: Fri, 17 Jan 2025 12:15:22 +0100

Daniel Mendler <[email-masked]> writes:

> Sometimes `restart-emacs' fails to restart Emacs. In my setup this
> happens in particular after recompiling my init.el and then invoking
> `restart-emacs'. This is an unfortunate coincidence, since my only
> motivation to restart Emacs is in the case where I've applied
> significant configuration changes. My Emacs is started from .xsession
> via `exec emacs' since EXWM is my window manager. Unfortunately I've not
> managed to create a minimal recipe so far. Has this problem been
> observed before?
>
> In GNU Emacs 30.0.93 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
>  version 1.18.2, Xaw scroll bars)
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101015
> System Description: Debian GNU/Linux trixie/sid
>
> Configured using:
>  'configure --with-tree-sitter
>  --with-native-compilation --with-x-toolkit=athena --with-dbus
>  --without-selinux --without-threads --without-gsettings --without-gpm
>  --with-cairo --with-cairo-xcb --disable-gc-mark-trace --with-xinput2'
>
> Configured features:
> CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSYSTEMD
> LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
> SOUND SQLITE3 TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM
> XINPUT2 XPM LUCID ZLIB

I've found the following backtrace in my .xsession-errors file. It seems
that Emacs is somehow crashing during shutdown. So maybe the problem is
not really about restart, but about some redisplay problem happening
during shutdown.

X protocol error: BadDrawable (invalid Pixmap or Window parameter) on protocol request 62
Serial no: 6422
Failing resource ID (if any): 0x60014c
Minor code: 0
This is a bug!  Please report this to [email-masked]!

Backtrace:
emacs(emacs_backtrace+0x3b) [0x55943fdecdfb]
emacs(terminate_due_to_signal+0x6f) [0x55943fca1f4b]
emacs(+0x8a4db) [0x55943fca24db]
emacs(+0x8759c) [0x55943fc9f59c]
emacs(redisplay_preserve_echo_area+0xc5) [0x55943fcfd5c5]
emacs(Fdelete_process+0x106) [0x55943feb8946]
emacs(Ffuncall+0xf6) [0x55943fe5eae6]
~/.config/emacs/eln-cache/30.0.93-9cf938b6/server-0cc44189-400d6018.eln(F7365727665722d73746f70_server_stop_0+0x34a) [0x7f3042f90d3a]
emacs(Ffuncall+0xf6) [0x55943fe5eae6]
~/.config/emacs/eln-cache/30.0.93-9cf938b6/server-0cc44189-400d6018.eln(F7365727665722d666f7263652d73746f70_server_force_stop_0+0x9c) [0x7f3042f91cfc]
emacs(Ffuncall+0xf6) [0x55943fe5eae6]
~/.local/share/emacs/bin/../lib/emacs/30.0.93/native-lisp/30.0.93-9cf938b6/preloaded/subr-13adf6a6-122bc881.eln(F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_148+0x156) [0x7f30467b9c06]
emacs(Ffuncall+0xf6) [0x55943fe5eae6]
emacs(+0x24718d) [0x55943fe5f18d]
emacs(run_hook_with_args+0xd2) [0x55943fe5a9d2]
~/.local/share/emacs/bin/../lib/emacs/30.0.93/native-lisp/30.0.93-9cf938b6/preloaded/subr-13adf6a6-122bc881.eln(F72756e2d686f6f6b2d71756572792d6572726f722d776974682d74696d656f7574_run_hook_query_error_with_timeout_0+0x33) [0x7f30467b9c63]
emacs(Ffuncall+0xf6) [0x55943fe5eae6]
emacs(Fkill_emacs+0xca) [0x55943fca1e30]
emacs(+0x89219) [0x55943fca1219]
emacs(+0x17bebb) [0x55943fd93ebb]
emacs(+0x17c08b) [0x55943fd9408b]
/lib/x86_64-linux-gnu/libX11.so.6(_XError+0x11c) [0x7f304ebe26dc]
/lib/x86_64-linux-gnu/libX11.so.6(+0x4524f) [0x7f304ebdf24f]
/lib/x86_64-linux-gnu/libX11.so.6(+0x452fd) [0x7f304ebdf2fd]
/lib/x86_64-linux-gnu/libX11.so.6(_XReply+0x1fd) [0x7f304ebe048d]
/lib/x86_64-linux-gnu/libX11.so.6(XGetWindowProperty+0x112) [0x7f304ebc44e2]
emacs(+0x182049) [0x55943fd9a049]
emacs(+0x1890fa) [0x55943fda10fa]
emacs(+0x1918fd) [0x55943fda98fd]
emacs(gobble_input+0x111) [0x55943fdd3da1]
emacs(unblock_input+0x55) [0x55943fdd5945]
emacs(redisplay_preserve_echo_area+0xb2) [0x55943fcfd5b2]
emacs(Fdelete_process+0x106) [0x55943feb8946]
emacs(exec_byte_code+0x3dd) [0x55943fea79ed]
emacs(Ffuncall+0xf6) [0x55943fe5eae6]
emacs(Fapply+0x2e8) [0x55943fe5eff8]
emacs(exec_byte_code+0x3dd) [0x55943fea79ed]
emacs(Ffuncall+0xf6) [0x55943fe5eae6]
~/.config/emacs/eln-cache/30.0.93-9cf938b6/xcb-708db4e5-752e3495.eln(F7863623a2d636f6e6e656374696f6e2d73656e74696e656c_xcb_connection_sentinel_0+0x95) [0x7f3042f40945]
emacs(Ffuncall+0xf6) [0x55943fe5eae6]
emacs(Fapply+0x150) [0x55943fe5ee60]
...
Aborted