emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GTK stack-busting loop


From: Chong Yidong
Subject: GTK stack-busting loop
Date: Sun, 31 Oct 2010 00:00:31 -0400

On the trunk, with GTK, the following recipe causes an infloop:

1. emacs -Q -nw -f server-start
2. emacsclient -c
3. In another terminal, run `xkill' and click on the GTK toolbar

The backtrace is at the end of this message.  It can be obtained by
attaching to the looping Emacs process in another gdb session.
Eventually, the loop overflows the stack.

This bug does not occur on the emacs-23 branch, nor if you click `xkill'
on other parts of the graphical frame.  In those cases, Emacs aborts as
it now ought to.

The infloop arises when, during the UNBLOCK_INPUT at the end of
XTread_socket, Emacs checks for and processes more incoming input, via
read_avail_input.  Somehow, with the malfunctioning GTK code, this leads
to another XTread_socket call, etc.  I am not sure why the bug does not
manifest itself on the branch.  Anyone know?  (Jan?)

More generally, the possibility of such an infloop seems to indicate
that it makes sense not to use the normal UNBLOCK_INPUT at the end of
XTread_socket, but instead do this:

*** src/xterm.c 2010-10-25 16:04:54 +0000
--- src/xterm.c 2010-10-31 03:51:26 +0000
***************
*** 7056,7062 ****
      }
  
    --handling_signal;
!   UNBLOCK_INPUT;
  
    return count;
  }
--- 7056,7062 ----
      }
  
    --handling_signal;
!   --interrupt_input_blocked;
  
    return count;
  }

Any thoughts?  (Stefan?)

Here's the backtrace:

#0  0x00007f3a0e9838c0 in __write_nocancel () from /lib/libpthread.so.0
#1  0x00007f3a0ebdac8c in g_log_default_handler () from /lib/libglib-2.0.so.0
#2  0x00007f3a0ebdafb9 in g_logv () from /lib/libglib-2.0.so.0
#3  0x00007f3a0ebdb3d3 in g_log () from /lib/libglib-2.0.so.0
#4  0x00007f3a0ebd3a84 in g_main_context_check () from /lib/libglib-2.0.so.0
#5  0x00007f3a0ebd44c3 in ?? () from /lib/libglib-2.0.so.0
#6  0x00007f3a0ebd4a14 in g_main_context_pending () from /lib/libglib-2.0.so.0
#7  0x00007f3a111e3ab9 in gtk_events_pending ()
   from /usr/lib/libgtk-x11-2.0.so.0
#8  0x00000000004f6dc5 in XTread_socket (terminal=0x10a2e10, expected=1,
    hold_quit=0x7fff184c7fc0) at xterm.c:7009
#9  0x0000000000546059 in read_avail_input (expected=1) at keyboard.c:6969
#10 0x00000000005469e2 in handle_async_input () at keyboard.c:7292
#11 0x0000000000546af1 in reinvoke_input_signal () at keyboard.c:7348
#12 0x00000000004f6e94 in XTread_socket (terminal=0x10a2e10, expected=1,
    hold_quit=0x7fff184c8200) at xterm.c:7059
#13 0x0000000000546059 in read_avail_input (expected=1) at keyboard.c:6969
#14 0x00000000005469e2 in handle_async_input () at keyboard.c:7292
#15 0x0000000000546af1 in reinvoke_input_signal () at keyboard.c:7348
#16 0x00000000004f6e94 in XTread_socket (terminal=0x10a2e10, expected=1,
    hold_quit=0x7fff184c8440) at xterm.c:7059



reply via email to

[Prev in Thread] Current Thread [Next in Thread]