Subject: bug#1310: 23.0.60; Emacs daemon behaves strangely if client loses X connection

From: "Espen Wiborg" <[email-masked]>
Date: Mon, 10 Nov 2008 20:48:33 +0100 (CET)

On Mon, November 10, 2008 09:29, Dan Nicolaescu wrote:
> "Espen Wiborg" <[email-masked]> writes:
>   > With the patch the behavior is less deterministic:
>   >
>   > Emacs usually survives the first X crash, and will at this point happily serve
>   > clients and create frames.
>   >
>   > The second crash usually calls abort() with the following backtrace:
>
> Unfortunately, I am still not able to play with killing X, so I can only
> offer guesses, but no real debugging...

I test by starting the daemon under a different name (./emacs -Q --daemon=testing) and
then run a secondary X server serving just the client with

startx `which emacsclient` -c -s /tmp/emacs`id -u`/testing -- :1

I can then zap the secondary X, e.g. with C-M-Backspace, without affecting my real session.

This trick is also useful to test strange resolutions, color depths etc.

> Does the problem happen if you configure emacs without Gtk (i.e.
> --with-x-toolkit=lucid)?

No, it doesn't.  Or at least it happens much less frequently; in 35-40 tries I could
only provoke something once, but that seems to have been a clean shutdown (which is
infinitely preferable to the hang I get with Gtk enabled).

> Also, can you try if the problem happens if you do:
> in a text console: emacs -Q -f server-start
> now start X, and run emacsclient -c to connect to the server
> and kill X
> (this is to verify if the problem is related to --daemon, I am guessing
> it should not be, and similar problems were fixed long time ago...)

Interesting.  With the Gtk-enabled Emacs, I get the same behavior as with --daemon, but
when I try to open a new frame after killing X, my console is spammed with

(emacs:6078): GLib-WARNING **: g_main_context_prepare() called recursively from within a
source's check() or prepare() member.

ad infinitum.

So it definitely looks as if Gtk is the culprit (or at least part of the problem).

I'm running this on Ubuntu 8.10, Intrepid Ibex; I appeare to have Gtk 2.14.4-0ubuntu1
installed.

-- 
Espen Wiborg <[email-masked]> - Veritas vos liberabit
A twisted mind is a joy forever.