all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: emacs-devel@gnu.org
Subject: Re: Hang in "double/triple" select()
Date: Sat, 23 Sep 2006 15:52:53 +0200	[thread overview]
Message-ID: <45153C35.4090507@swipnet.se> (raw)
In-Reply-To: <m3psdoytb1.fsf@kfs-l.imdomain.dk>



Kim F. Storm skrev:
> I happened to be using a "slightly old" version of CVS Emacs 
> 
> GNU Emacs 22.0.50.3 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
> of 2006-01-19 on kfs-l.imdomain.dk
> 
> and went away from the screen for an hours so, and when I returned,
> Emacs was stuck in a non-responsive mode with a "blank" emacs frame.
> 
> I attached to it with GDB, and this is what I got:
> 
> bt
> #0  0x403d8122 in select () from /lib/libc.so.6
> #1  0x402bbdc4 in _XlcPublicMethods () from /usr/X11R6/lib/libX11.so.6
> #2  0x40210ee8 in _XFlush () from /usr/X11R6/lib/libX11.so.6
> #3  0x402124fd in _XReply () from /usr/X11R6/lib/libX11.so.6
> #4  0x401ff722 in XInternAtom () from /usr/X11R6/lib/libX11.so.6
> #5  0x4066bf31 in _XimExtension ()
>    from /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
> #6  0x4022e515 in XFilterEvent () from /usr/X11R6/lib/libX11.so.6
> #7  0x080e59f5 in x_filter_event (dpyinfo=0x8621100, event=0xbfffd8a4)
>     at xterm.c:5586
> #8  0x080e7ad1 in XTread_socket (sd=0, expected=1, hold_quit=0xbfffe974)
>     at xterm.c:7016
> #9  0x0811a03b in read_avail_input (expected=1) at keyboard.c:6712
> #10 0x0811a232 in handle_async_input () at keyboard.c:6858
> #11 0x0811a275 in input_available_signal (signo=29) at keyboard.c:6900
> #12 <signal handler called>
> #13 0x403d8122 in select () from /lib/libc.so.6
> #14 0x00000010 in ?? ()
> #15 0x081164a6 in kbd_buffer_get_event (kbp=0xbffff0a0,
>     used_mouse_menu=0xbffff39c) at keyboard.c:3935

It looks like select is not signalsafe and/or reentrant.  If that is the case, 
there is always a risk that Emacs will hang.  The best solution would be to 
move to SYNC_INPUT.  The second solution would be to have a flag that tells 
the signal handler if we are in select.  If so, it just writes a byte to a 
pipe we have in the select read set and exits.  This makes select exit, and we 
can handle X input.

Has this only happened once?  Can you provoke it?  I would think marking some 
text in Emacs so it grabs the PRIMARY selection, and then yank that text in an 
xterm for example.  If Emacs is idle, there is a fair chanse that it is in 
select() in this case.  Unless there are timers and such running.

	Jan D.

  reply	other threads:[~2006-09-23 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-22 12:33 Hang in "double/triple" select() Kim F. Storm
2006-09-23 13:52 ` Jan Djärv [this message]
2006-09-23 23:00   ` Kim F. Storm
2006-09-24 16:28     ` Richard Stallman

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=45153C35.4090507@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --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.