Subject: Re: bug#14828: 24.3.50; crash on exit from ediff

From: Jan Djärv <[email-masked]>
Date: Tue, 9 Jul 2013 10:15:08 +0200

Hello.

8 jul 2013 kl. 22:05 skrev Sam Steingold <[email-masked]>:

> I ran ediff, hit q in the tiny "command" frame and both it and the main
> emacs frame disappeared. I.e., there are no emacs frames (windows) on my
> desktop. However, emacs is still running (at 100% CPU!):
> 
> 13425 sds       20   0  639m 179m  12m R  99.7  2.3  30:48.11 emacs
> 
> (gdb) xbacktrace 
> 

This is the root cause:

> #22 0x00000000004b1441 in x_connection_closed (dpy=dpy@entry=0xc35d40, error_message=<optimized out>, 
>    error_message@entry=0x7fffffffb720 "X protocol error: BadWindow (invalid Window parameter) on protocol request 42")
>    at /home/sds/src/emacs/trunk/src/xterm.c:7756
>        dpyinfo = 0xd35e40
>        tail = 15780134
> #23 0x00000000004b37f2 in x_error_quitter (display=0xc35d40, event=<optimized out>, event=<optimized out>)
>    at /home/sds/src/emacs/trunk/src/xterm.c:7869
>        buf = "BadWindow (invalid Window parameter)", '\000' <repeats 219 times>
>        buf1 = "X protocol error: BadWindow (invalid Window parameter) on protocol request 42\000\000\000\320\t\375\367\377\177\000\000}9\362\364\377\177\000\000X*\362\364\377\177\000\000@\353\361\364\377\177\000\000\000\000\000\000\005\000\000\000\276\002\000\000\001", '\000' <repeats 11 times>, "H\271\377\377\377\177\000\000 \271\377\377\377\177\000\000\000\000\000\000\000\000\000\000(\r\375\367\377\177\000\000\320\t\375\367\377\177\000\000\005\000\000\000\000\000\000\000\311A\336\367\377\177", '\000' <repeats 18 times>...
> #24 0x00000000004b3845 in x_error_handler (event=<optimized out>, display=<optimized out>) at /home/sds/src/emacs/trunk/src/xterm.c:7839
> No locals.
> #25 x_error_handler (display=<optimized out>, event=<optimized out>) at /home/sds/src/emacs/trunk/src/xterm.c:7825
> No locals.
> #26 0x00007ffff4f5d516 in _XError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
> No symbol table info available.
> #27 0x00007ffff4f5a791 in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6
> No symbol table info available.
> #28 0x00007ffff4f5a7d5 in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6
> No symbol table info available.
> #29 0x00007ffff4f5b3c8 in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6
> No symbol table info available.
> #30 0x00007ffff4f56d5d in XSync () from /usr/lib/x86_64-linux-gnu/libX11.so.6
> No symbol table info available.
> #31 0x00007ffff66c3499 in gdk_window_process_all_updates () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
> No symbol table info available.
> #32 0x00000000004b6173 in x_catch_errors (dpy=0xc35d40) at /home/sds/src/emacs/trunk/src/xterm.c:7611
>        data = 0x56cdbd0
> #33 0x00000000004b666c in frame_highlight (f=0x1134950) at /home/sds/src/emacs/trunk/src/xterm.c:3363
> No locals.
> #34 x_frame_rehighlight (dpyinfo=<optimized out>, dpyinfo=<optimized out>) at /home/sds/src/emacs/trunk/src/xterm.c:3572
>        old_highlight = 0x0
> #35 0x00000000004b689b in x_focus_changed (frame=0x1134950, dpyinfo=<optimized out>, state=2, type=<optimized out>, bufp=<optimized out>)
>    at /home/sds/src/emacs/trunk/src/xterm.c:3430
> No locals.
> #36 x_focus_changed (type=<optimized out>, state=2, dpyinfo=<optimized out>, frame=0x1134950, bufp=<optimized out>, bufp=<optimized out>)
>    at /home/sds/src/emacs/trunk/src/xterm.c:3424
> No locals.
> #37 0x00000000004b6a42 in x_detect_focus_change (dpyinfo=<optimized out>, event=<optimized out>, bufp=<optimized out>)
>    at /home/sds/src/emacs/trunk/src/xterm.c:3515
>        msg = <optimized out>
>        frame = <optimized out>

42 is SetInputFocus.  So Emacs tries to set focus to an X window that has been deleted.  That fails, and Emacs tries to close the display.  The loop you see is just the old Gtk+ bug, it can't close a display properly.

Does it happen all the time?  My guess is that it is some sort of timing involved, like an X window has been deleted on the server, but Emacs has not updated its state yet.

	Jan D.