Subject: Re: bug#39081: 26.3; Emacs hangs if external SCIM input method is killed

From: Vladimir Nikishkin <[email-masked]>
Date: Sun, 12 Jan 2020 14:49:12 +0800

Sorry, my debugging skills are too poor.

So I attached gdb to Emacs, cont'd, then killed scim, and then
interrupted Emacs by issuing C-c in the gdb prompt,
and then collected a stack trace. I am not sure I am doing something
meaningful, as this is the first time I use gdb:
Here's the stack trace:

Thread 1 "emacs" received signal SIGINT, Interrupt.
0x00007f5e0c908e9f in poll () from /lib64/libc.so.6
(gdb) thread apply all bt

Thread 3 (Thread 0x7f5e093b9700 (LWP 1967)):
#0  0x00007f5e0c908e9f in poll () at /lib64/libc.so.6
#1  0x00007f5e0e70dcee in  () at /usr/lib64/libglib-2.0.so.0
#2  0x00007f5e0e70e053 in g_main_loop_run () at /usr/lib64/libglib-2.0.so.0
#3  0x00007f5e0e943666 in  () at /usr/lib64/libgio-2.0.so.0
#4  0x00007f5e0e73598d in  () at /usr/lib64/libglib-2.0.so.0
#5  0x00007f5e0ced606b in start_thread () at /lib64/libpthread.so.0
#6  0x00007f5e0c91472f in clone () at /lib64/libc.so.6

Thread 2 (Thread 0x7f5e0a3d9700 (LWP 1966)):
#0  0x00007f5e0c908e9f in poll () at /lib64/libc.so.6
#1  0x00007f5e0e70dcee in  () at /usr/lib64/libglib-2.0.so.0
#2  0x00007f5e0e70de0f in g_main_context_iteration () at
/usr/lib64/libglib-2.0.so.0
#3  0x00007f5e0e70de61 in  () at /usr/lib64/libglib-2.0.so.0
#4  0x00007f5e0e73598d in  () at /usr/lib64/libglib-2.0.so.0
#5  0x00007f5e0ced606b in start_thread () at /lib64/libpthread.so.0
#6  0x00007f5e0c91472f in clone () at /lib64/libc.so.6

--Type <RET> for more, q to quit, c to continue without paging--
Thread 1 (Thread 0x7f5e0ae93c80 (LWP 1965)):
#0  0x00007f5e0c908e9f in poll () at /lib64/libc.so.6
#1  0x00007f5e0e533d17 in  () at /usr/lib64/libxcb.so.1
#2  0x00007f5e0e53580a in xcb_wait_for_event () at /usr/lib64/libxcb.so.1
#3  0x00007f5e0e598328 in _XReadEvents () at /usr/lib64/libX11.so.6
#4  0x00007f5e0e5807f5 in XIfEvent () at /usr/lib64/libX11.so.6
#5  0x00007f5e0e5c621f in  () at /usr/lib64/libX11.so.6
#6  0x00007f5e0e5c6bc2 in  () at /usr/lib64/libX11.so.6
#7  0x00007f5e0e5c6e5c in _XimRead () at /usr/lib64/libX11.so.6
#8  0x00007f5e0e5b5bdb in  () at /usr/lib64/libX11.so.6
#9  0x00007f5e0e5a4f15 in XSetICValues () at /usr/lib64/libX11.so.6
#10 0x00000000004e0beb in xic_set_preeditarea (w=w@entry=0x1328920,
x=x@entry=163, y=y@entry=84) at xfns.c:2785
#11 0x00000000004ce685 in x_draw_window_cursor (w=0x1328920,
glyph_row=0x1adee70, x=163, y=84, cursor_type=<optimized out>,
cursor_width=<optimized out>, on_p=<optimized out>,
active_p=<optimized out>) at xterm.c:9700
#12 0x000000000046b4e7 in display_and_set_cursor (w=0x1328920,
on=<optimized out>, hpos=11, vpos=3, x=163, y=<optimized out>) at
xdisp.c:31324
#13 0x000000000046be46 in update_window_cursor (w=<optimized out>,
on=<optimized out>) at xdisp.--Type <RET> for more, q to quit, c to
continue without paging--
c:31359
#14 0x000000000046beaa in update_cursor_in_window_tree (w=0x1328920,
on_p=on_p@entry=true) at xdisp.c:31377
#15 0x000000000046bed9 in update_cursor_in_window_tree (w=0x2879ea0,
on_p=on_p@entry=true) at lisp.h:730
#16 0x000000000046bf01 in gui_update_cursor (f=f@entry=0x13245c0,
on_p=on_p@entry=true) at lisp.h:730
#17 0x00000000004d3473 in x_frame_highlight (f=<optimized out>) at xterm.c:4488
#18 0x00000000004d3473 in x_frame_rehighlight (dpyinfo=<optimized
out>, dpyinfo=<optimized out>) at xterm.c:4860
#19 0x00000000004d35c4 in x_focus_changed (type=<optimized out>,
state=2, dpyinfo=0x110b680, frame=0x13245c0, bufp=0x7ffc81d0f240) at
xterm.c:4550
#20 0x00000000004d49c5 in handle_one_xevent (dpyinfo=0x110b680,
event=0x7ffc81d0f820, finish=0x9c35d0 <current_finish>,
hold_quit=0x7ffc81d0fa70) at xterm.c:8802
#21 0x00000000004d6eee in event_handler_gdk (gxev=0x7ffc81d0f820,
ev=<optimized out>, data=<optimized out>) at xterm.c:7773
#22 0x00007f5e0ec4999f in  () at /usr/lib64/libgdk-3.so.0
#23 0x00007f5e0ec49cbb in  () at /usr/lib64/libgdk-3.so.0
#24 0x00007f5e0ec14030 in gdk_display_get_event () at /usr/lib64/libgdk-3.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#25 0x00007f5e0ec49a32 in  () at /usr/lib64/libgdk-3.so.0
#26 0x00007f5e0e70db2d in g_main_context_dispatch () at
/usr/lib64/libglib-2.0.so.0
#27 0x00007f5e0e70dd80 in  () at /usr/lib64/libglib-2.0.so.0
#28 0x00007f5e0e70de0f in g_main_context_iteration () at
/usr/lib64/libglib-2.0.so.0
#29 0x00007f5e0eee2105 in gtk_main_iteration () at /usr/lib64/libgtk-3.so.0
#30 0x00000000004cabf3 in XTread_socket (terminal=<optimized out>,
hold_quit=0x7ffc81d0fa70) at xterm.c:9386
#31 0x00000000004fd5f2 in gobble_input () at keyboard.c:6891
#32 0x00000000004fdb95 in handle_async_input () at keyboard.c:7128
#33 0x00000000004fdb95 in process_pending_signals () at keyboard.c:7142
#34 0x0000000000572d6b in list_length (list=0x2287cb3) at lisp.h:1449
#35 0x0000000000572ea8 in Flength (sequence=<optimized out>) at fns.c:129
#36 0x000000000057300d in concat (nargs=1, args=0x7ffc81d0fc08,
target_type=Lisp_Cons, last_special=<optimized out>) at fns.c:680
#37 0x0000000000573d33 in Fcopy_sequence (arg=<optimized out>) at lisp.h:745
#38 0x00000000004fc83c in timer_check () at keyboard.c:4387
#39 0x00000000004fcd45 in readable_events (flags=flags@entry=1) at
keyboard.c:3397
#40 0x00000000004fd758 in get_input_pending (flags=flags@entry=1) at
keyboard.c:6809
#41 0x0000000000500638 in detect_input_pending_run_timers
(do_display=do_display@entry=true) at --Type <RET> for more, q to
quit, c to continue without paging--
keyboard.c:10367
#42 0x00000000005a7024 in wait_reading_process_output
(time_limit=time_limit@entry=15, nsecs=nsecs@entry=0,
read_kbd=read_kbd@entry=-1, do_display=do_display@entry=true,
wait_for_cell=wait_for_cell@entry=0x0, wait_proc=wait_proc@entry=0x0,
just_wait_proc=0) at process.c:5707
#43 0x000000000042d82f in sit_for (timeout=timeout@entry=0x3e,
reading=reading@entry=true, display_option=display_option@entry=1) at
lisp.h:1032
#44 0x00000000005032e8 in read_char (commandflag=1, map=0x2c9f583,
prev_event=0x0, used_mouse_menu=0x7ffc81d107ab, end_time=0x0) at
lisp.h:1147
#45 0x000000000050380e in read_key_sequence (keybuf=<optimized out>,
prompt=0x0, dont_downcase_last=<optimized out>,
can_return_switch_frame=true, fix_current_buffer=true,
prevent_redisplay=<optimized out>) at keyboard.c:9553
#46 0x0000000000504e8e in command_loop_1 () at lisp.h:1032
#47 0x0000000000568d37 in internal_condition_case
(bfun=bfun@entry=0x504cb0 <command_loop_1>,
handlers=handlers@entry=0x90, hfun=hfun@entry=0x4fbee0 <cmd_error>) at
eval.c:1355
#48 0x00000000004f6cfc in command_loop_2 (ignore=ignore@entry=0x0) at
lisp.h:1032
#49 0x0000000000568c91 in internal_catch (tag=tag@entry=0xd4d0,
func=func@entry=0x4f6ce0 <command_loop_2>, arg=arg@entry=0x0) at
eval.c:1116
#50 0x00000000004f6ca4 in command_loop () at lisp.h:1032
#51 0x00000000004fbaf6 in recursive_edit_1 () at keyboard.c:714
--Type <RET> for more, q to quit, c to continue without paging--
#52 0x00000000004fbe20 in Frecursive_edit () at keyboard.c:786
#53 0x0000000000423f25 in main (argc=1, argv=0x7ffc81d10ca8) at emacs.c:2054
(gdb)

вс, 12 янв. 2020 г. в 14:40, Vladimir Nikishkin <[email-masked]>:
>
> Below is the thread apply all bt result for a hanged, unoptimized,
> Emacs. I attached gdb after start, but before killing SCIM:
>
> lockywolf@delllaptop:~$ pgrep emacs
> 1437
> lockywolf@delllaptop:~$ gdb -p $(pgrep emacs)
> /usr/share/gdb/python/gdb/command/prompt.py:48: SyntaxWarning: "is
> not" with a literal. Did you mean "!="?
>   if self.value is not '':
> /usr/share/gdb/python/gdb/command/prompt.py:60: SyntaxWarning: "is
> not" with a literal. Did you mean "!="?
>   if self.value is not '':
> GNU gdb (GDB) 8.3.1
> Copyright (C) 2019 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "x86_64-slackware-linux".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>     <http://www.gnu.org/software/gdb/documentation/>.
>
> For help, type "help".
> Type "apropos word" to search for commands related to "word".
> Attaching to process 1437
> [New LWP 1438]
> [New LWP 1439]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> 0x00007f395c99807e in pselect () from /lib64/libc.so.6
> (gdb) thread apply all bt
>
> Thread 3 (Thread 0x7f3959446700 (LWP 1439)):
> #0  0x00007f395c995e9f in poll () at /lib64/libc.so.6
> #1  0x00007f395e79acee in  () at /usr/lib64/libglib-2.0.so.0
> #2  0x00007f395e79b053 in g_main_loop_run () at /usr/lib64/libglib-2.0.so.0
> #3  0x00007f395e9d0666 in  () at /usr/lib64/libgio-2.0.so.0
> #4  0x00007f395e7c298d in  () at /usr/lib64/libglib-2.0.so.0
> #5  0x00007f395cf6306b in start_thread () at /lib64/libpthread.so.0
> #6  0x00007f395c9a172f in clone () at /lib64/libc.so.6
>
> Thread 2 (Thread 0x7f395a466700 (LWP 1438)):
> #0  0x00007f395c995e9f in poll () at /lib64/libc.so.6
> #1  0x00007f395e79acee in  () at /usr/lib64/libglib-2.0.so.0
> #2  0x00007f395e79ae0f in g_main_context_iteration () at
> /usr/lib64/libglib-2.0.so.0
> #3  0x00007f395e79ae61 in  () at /usr/lib64/libglib-2.0.so.0
> #4  0x00007f395e7c298d in  () at /usr/lib64/libglib-2.0.so.0
> #5  0x00007f395cf6306b in start_thread () at /lib64/libpthread.so.0
> --Type <RET> for more, q to quit, c to continue without paging--
> #6  0x00007f395c9a172f in clone () at /lib64/libc.so.6
>
> Thread 1 (Thread 0x7f395af20c80 (LWP 1437)):
> #0  0x00007f395c99807e in pselect () at /lib64/libc.so.6
> #1  0x00000000005c5bd0 in really_call_select (arg=0x7ffff4d2e960) at
> thread.c:586
> #2  0x00000000005c66a7 in thread_select (func=<optimized out>,
> max_fds=max_fds@entry=20, rfds=rfds@entry=0x7ffff4d2ea10,
> wfds=wfds@entry=0x7ffff4d2ea90, efds=efds@entry=0x0,
> timeout=timeout@entry=0x7ffff4d2f010, sigmask=0x0) at thread.c:616
> #3  0x00000000005e0e34 in xg_select (fds_lim=20,
> rfds=rfds@entry=0x7ffff4d2f120, wfds=wfds@entry=0x7ffff4d2f1a0,
> efds=efds@entry=0x0, timeout=timeout@entry=0x7ffff4d2f010,
> sigmask=sigmask@entry=0x0) at xgselect.c:117
> #4  0x00000000005a6db3 in wait_reading_process_output
> (time_limit=time_limit@entry=15, nsecs=nsecs@entry=0,
> read_kbd=read_kbd@entry=-1, do_display=do_display@entry=true,
> wait_for_cell=wait_for_cell@entry=0x0, wait_proc=wait_proc@entry=0x0,
> just_wait_proc=0) at process.c:5571
> #5  0x000000000042d82f in sit_for (timeout=timeout@entry=0x3e,
> reading=reading@e--Type <RET> for more, q to quit, c to continue
> without paging--
> ntry=true, display_option=display_option@entry=1) at lisp.h:1032
> #6  0x00000000005032e8 in read_char (commandflag=1, map=0x3f872e3,
> prev_event=0x0, used_mouse_menu=0x7ffff4d2f9db, end_time=0x0) at
> lisp.h:1147
> #7  0x000000000050380e in read_key_sequence (keybuf=<optimized out>,
> prompt=0x0, dont_downcase_last=<optimized out>,
> can_return_switch_frame=true, fix_current_buffer=true,
> prevent_redisplay=<optimized out>) at keyboard.c:9553
> #8  0x0000000000504e8e in command_loop_1 () at lisp.h:1032
> #9  0x0000000000568d37 in internal_condition_case
> (bfun=bfun@entry=0x504cb0 <command_loop_1>,
> handlers=handlers@entry=0x90, hfun=hfun@entry=0x4fbee0 <cmd_error>) at
> eval.c:1355
> #10 0x00000000004f6cfc in command_loop_2 (ignore=ignore@entry=0x0) at
> lisp.h:1032
> #11 0x0000000000568c91 in internal_catch (tag=tag@entry=0xd4d0,
> func=func@entry=0x4f6ce0 <command_loop_2>, arg=arg@entry=0x0) at
> eval.c:1116
> #12 0x00000000004f6ca4 in command_loop () at lisp.h:1032
> #13 0x00000000004fbaf6 in recursive_edit_1 () at keyboard.c:714
> #14 0x00000000004fbe20 in Frecursive_edit () at keyboard.c:786
> #15 0x0000000000423f25 in main (argc=1, argv=0x7ffff4d2fed8) at emacs.c:2054
> (gdb)
>
> вс, 12 янв. 2020 г. в 14:34, Eli Zaretskii <[email-masked]>:
> >
> > On January 12, 2020 8:05:06 AM GMT+02:00, Vladimir Nikishkin <[email-masked]> wrote:
> > > Okay, I rebuild Emacs from git with debug information, and after a few
> > > attempts, Emacs crashed, printing "This is a GTK bug".
> > > I am not sure why optimized Emacs hangs instead of crashing.
> > > Maybe this bug can be closed (or maybe there is an interleaving
> > > between two bugs)
> >
> > Please run Emacs under GDB, and when it crashes, please show the backtrace.  I'd like to see the details of this crash, perhaps this is some known problem.  Those details might also explain the difference in behavior between the optimized and debug builds.
> >
> > Thanks.
>
>
>
> --
> Yours sincerely, Vladimir Nikishkin

-- 
Yours sincerely, Vladimir Nikishkin