Subject: bug#16676: 24.3.50; Repeated but random hang

From: Eli Zaretskii <[email-masked]>
Date: Fri, 07 Feb 2014 09:39:20 +0200

> From: Lars Ingebrigtsen <[email-masked]>
> Date: Thu, 06 Feb 2014 16:53:28 -0800
> 
> This has happened to me a handful of times now.  I'm reading news, and
> then Emacs will suddenly halt.
> 
> Connecting to Emacs with gdb gives me the backtrace below.  Emacs will
> consume 100% CPU at this point.

Doesn't the following part of the backtrace (in particular, frame #10)
explain what happened?

> #9  0x0000000000422fda in delete_frame (frame=<optimized out>, force=12207810)
>     at frame.c:1378
> #10 0x00000000004b4450 in x_connection_closed (dpy=dpy@entry=0x1378070, 
>     error_message=<optimized out>, 
>     error_message@entry=0x7fffbe39c450 "Connection lost to X server `:0'")
>     at xterm.c:7569
> #11 0x00000000004b44fc in x_io_error_quitter (display=0x1378070)
>     at xterm.c:7696
> #12 0x0000003f4de43cce in _XIOError () from /lib64/libX11.so.6
> #13 0x0000003f4de417ba in _XReadEvents () from /lib64/libX11.so.6
> #14 0x0000003f4de29e51 in XIfEvent () from /lib64/libX11.so.6
> #15 0x0000003f4de706e4 in _XimXRead () from /lib64/libX11.so.6
> #16 0x0000003f4de71330 in _XimReadData () from /lib64/libX11.so.6
> #17 0x0000003f4de71621 in _XimRead () from /lib64/libX11.so.6
> #18 0x0000003f4de600d6 in _XimProtoSetICValues () from /lib64/libX11.so.6
> #19 0x0000003f4de4e2ad in XSetICValues () from /lib64/libX11.so.6
> #20 0x00000000004c59b3 in xic_set_preeditarea (w=w@entry=0x479df28, 
>     x=x@entry=55, y=y@entry=528) at xfns.c:2061
> #21 0x00000000004b4ce5 in x_draw_window_cursor (w=0x479df28, 
>     glyph_row=<optimized out>, x=55, y=528, cursor_type=<optimized out>, 
>     cursor_width=<optimized out>, on_p=<optimized out>, 
>     active_p=<optimized out>) at xterm.c:7265
> #22 0x0000000000454fd3 in display_and_set_cursor (w=w@entry=0x479df28, 
>     on=on@entry=true, hpos=5, vpos=24, x=55, y=528) at xdisp.c:26983

My reading of this is: Emacs was at the end of a redisplay cycle, when
a call to an X function signaled an error because "Connection lost to
X server `:0'".  Then Emacs tried to delete the frame on that display,
which again involves calls to X.

Do you know why the connection was lost in the first place?

Or is the complaint that when the connection is lost, Emacs hangs?