all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Hang in "double/triple" select()
@ 2006-09-22 12:33 Kim F. Storm
  2006-09-23 13:52 ` Jan Djärv
  0 siblings, 1 reply; 4+ messages in thread
From: Kim F. Storm @ 2006-09-22 12:33 UTC (permalink / raw)



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
#16 0x081148c5 in read_char (commandflag=1, nmaps=5, maps=0xbffff2a0,
    prev_event=137847801, used_mouse_menu=0xbffff39c) at keyboard.c:2862
#17 0x0811d41c in read_key_sequence (keybuf=0xbffff510, bufsize=30,
---Type <return> to continue, or q <return> to quit---
    prompt=137847801, dont_downcase_last=0, can_return_switch_frame=1,
    fix_current_buffer=1) at keyboard.c:8857
#18 0x0811197c in command_loop_1 () at keyboard.c:1531
#19 0x0818a7aa in internal_condition_case (bfun=0x811167b <command_loop_1>,
    handlers=137892113, hfun=0x81111c0 <cmd_error>) at eval.c:1467
#20 0x081114f3 in command_loop_2 () at keyboard.c:1323
#21 0x0818a228 in internal_catch (tag=137888369,
    func=0x81114d4 <command_loop_2>, arg=137847801) at eval.c:1213
#22 0x081114a6 in command_loop () at keyboard.c:1302
#23 0x08110f3f in recursive_edit_1 () at keyboard.c:995
#24 0x08111080 in Frecursive_edit () at keyboard.c:1056
#25 0x0810f97d in main (argc=1, argv=0xbffffb24) at emacs.c:1789
#26 0x40311917 in __libc_start_main () from /lib/libc.so.6
(gdb)


Unfortunately, the gdb process also hangs shortly after this
(I made the stupid mistake of trying to flush Emacs' display.)


#0  0x403d8122 in select () from /lib/libc.so.6
#1  0x402bbdc4 in _XlcPublicMethods () from /usr/X11R6/lib/libX11.so.6
#2  0x40210f02 in _XFlush () from /usr/X11R6/lib/libX11.so.6
#3  0x40210d19 in _XFlush () from /usr/X11R6/lib/libX11.so.6
#4  0x401f75ec in XFlush () from /usr/X11R6/lib/libX11.so.6
#5  0x080dda1e in x_flush (f=0x86a2e00) at xterm.c:389
#6  0x080dd9e7 in x_flush (f=0x0) at xterm.c:386
#7  <function called from gdb>
(gdb)


I'm not sure how to interpret this -- but given the recent reports of
problems with emacs hanging in select() this might be related.

The kernel is some RedHat 9 enterprise edition:

Linux 2.4.21-builder-1 #3 Tue Aug 12 13:37:02 CDT 2003 i686 i686 i386 GNU/Linux


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hang in "double/triple" select()
  2006-09-22 12:33 Hang in "double/triple" select() Kim F. Storm
@ 2006-09-23 13:52 ` Jan Djärv
  2006-09-23 23:00   ` Kim F. Storm
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Djärv @ 2006-09-23 13:52 UTC (permalink / raw)
  Cc: emacs-devel



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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hang in "double/triple" select()
  2006-09-23 13:52 ` Jan Djärv
@ 2006-09-23 23:00   ` Kim F. Storm
  2006-09-24 16:28     ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Kim F. Storm @ 2006-09-23 23:00 UTC (permalink / raw)
  Cc: emacs-devel

Jan Djärv <jan.h.d@swipnet.se> writes:

> 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.

I now suspect that is related to someone replacing a router between
the PC running Emacs and the PC running the X-server while I was away.
.. so Emacs basically lost connection to the X-server, and for some
reason it didn't recover through the new router.

So if the select was waiting for input from the X server, it would
never return.

And a C-g on the X-server cannot get to the Emacs process.

I have also found an xterm window which showed the same problem -- so
it is a generic X problem - not specific to Emacs.


I think we can forget about this problem.  Sorry for the noise.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hang in "double/triple" select()
  2006-09-23 23:00   ` Kim F. Storm
@ 2006-09-24 16:28     ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2006-09-24 16:28 UTC (permalink / raw)
  Cc: jan.h.d, emacs-devel

    I now suspect that is related to someone replacing a router between
    the PC running Emacs and the PC running the X-server while I was away.
    .. so Emacs basically lost connection to the X-server, and for some
    reason it didn't recover through the new router.

So how come it didn't detect that it had lost the connection?  Aren't
apps supposed to be notified when they lose connection to the X
server?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-24 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-22 12:33 Hang in "double/triple" select() Kim F. Storm
2006-09-23 13:52 ` Jan Djärv
2006-09-23 23:00   ` Kim F. Storm
2006-09-24 16:28     ` Richard Stallman

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.