8

I start emacs daemon with the following commnad.

$ emacs --daemon

This seems to work. After this I start emacs client as follows

$ emacsclient -c

Whenever I close the emacsclient, the server also stops with the following error.

X protocol error: BadWindow (invalid Window parameter) on protocol request 42
When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
For details, see etc/PROBLEMS.
Fatal error (6)zsh: abort  

I have not found any information about this problem. Is there a way around this?

2
  • how do you close the emacs client? With C-x C-c or C-x 5 0
    – Trudbert
    Nov 27, 2012 at 13:49
  • I've tried both, the problem remains the same Nov 29, 2012 at 17:38

1 Answer 1

9

This is a known bug, FS#32423: emacsclient consistently crashes emacs. The bug has been reported to the Emacs authors. It is compounded by a Gtk bug. The following workarounds are reported to work:

  • Downgrading to Emacs 24.1 (instead of 24.2).
  • Downgrading Glib to 2.32 (instead of 2.34).
  • Compiling Emacs without Gtk (--with-x-toolkit=lucid).
  • Starting the daemon with no X connection available (try DISPLAY= emacs --daemon).

No actual solution seems to be known at this time.

This isn't something you can fix on your own unless you're a programmer and you're familiar with the technologies involved. Your best bet is to use one of the workarounds and keep watching the bug reports for a fix.

6
  • For what it's worth, I've tested option 4 with recent (ie: 24.3 release) builds of Emacs, and it does not work. I don't have GTK3 as an option, sadly, but GTK2 exhibits this behaviour irrespective of the DISPLAY state on launch; as near as I can tell from a read of the GTK bug, it's an issue with the client state tracking.
    – Chris R
    Mar 11, 2013 at 15:33
  • Emacs 24.5 has it too but at least the message seems to point to a solution: Warning: due to a long standing Gtk+ bug http://bugzilla.gnome.org/show_bug.cgi?id=85715 Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost. Using an Emacs configured with --with-x-toolkit=lucid does not have this problem. Oct 29, 2016 at 15:52
  • 1
    2020 and still an issue. And you cant compile in xwidgets without gtk. Painful.
    – RichieHH
    Jan 27, 2021 at 8:21
  • @MarcusJuniusBrutus Is it possible to compile GccEmacs with --with-x-toolkit=lucid flag?
    – alper
    Sep 29, 2021 at 0:07
  • @alper yes it is.
    – Atemu
    Feb 23, 2022 at 10:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .