Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug emacs crashes on WSL2

I installed Emacs using the instructions on this site. It was working fine for a while, but recently I have started experiencing frequent crashes. E.g. every 20 minutes, Emacs shuts down without warning and without saving anything. Sometimes, I get output printed in my terminal window, e.g.,

When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://gitlab.gnome.org/GNOME/gtk/issues/221
For details, see etc/PROBLEMS.
Backtrace:
emacs(+0x146b12)[0x560737d11b12]
emacs(+0x48d1b)[0x560737c13d1b]
emacs(+0x49209)[0x560737c14209]
emacs(+0x48291)[0x560737c13291]
emacs(+0x48360)[0x560737c13360]
/lib/x86_64-linux-gnu/libX11.so.6(_XIOError+0x52)[0x7fcd36f391a2]
/lib/x86_64-linux-gnu/libX11.so.6(_XEventsQueued+0x7d)[0x7fcd36f3685d]
/lib/x86_64-linux-gnu/libX11.so.6(XPending+0x61)[0x7fcd36f28171]
/lib/x86_64-linux-gnu/libgdk-3.so.0(+0x7020f)[0x7fcd376d920f]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_prepare+0x19f)[0x7fcd370af72f]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x520db)[0x7fcd370b00db]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_pending+0x2c)[0x7fcd370b027c]
/lib/x86_64-linux-gnu/libgtk-3.so.0(gtk_events_pending+0x12)[0x7fcd379bc402]

I am not 100% sure that the error message is correctly diagnosing the problem. But if we assume that it is a correct diagnosis, how would I re-install Emacs so that it can recover from X disconnects? Alternatively, how can I stop X from disconnecting?

like image 286
Philip Maybank Avatar asked Dec 06 '25 08:12

Philip Maybank


1 Answers

Since I did not find a solution to the specific issue I decided to stop using applications which require an X server with WSL2. I have had a good experience with Emacs installed via Chocolatey - https://community.chocolatey.org/packages/Emacs . I have also had good experiences with VS Code which seems to talk to WSL2 just as well as it talks to remote machines.

like image 162
Philip Maybank Avatar answered Dec 08 '25 21:12

Philip Maybank