all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: emacs-devel@gnu.org
Subject: GTK stack-busting loop
Date: Sun, 31 Oct 2010 00:00:31 -0400	[thread overview]
Message-ID: <8739rn810g.fsf@stupidchicken.com> (raw)

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	other threads:[~2010-10-31  4:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-31  4:00 Chong Yidong [this message]
2010-11-01  1:28 ` GTK stack-busting loop Stefan Monnier
2010-11-01 11:43 ` Jan Djärv
2010-11-01 16:03   ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8739rn810g.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.