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

From: Vladimir Nikishkin <[email-masked]>
Date: Tue, 14 Jan 2020 11:54:15 +0800

This is the "crashed" trace. Note the GTK message in between.

(gdb) run
Starting program: /usr/src/emacs/src/emacs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff2bf2700 (LWP 1270)]
[New Thread 0x7ffff1bd2700 (LWP 1274)]
[Detaching after vfork from child process 1278]
[Detaching after vfork from child process 1279]
[Detaching after vfork from child process 1282]
[Detaching after vfork from child process 1283]
[Detaching after vfork from child process 1285]
[Detaching after vfork from child process 1286]
[Detaching after vfork from child process 1287]
[Detaching after vfork from child process 1288]
[Detaching after vfork from child process 1289]
[Detaching after vfork from child process 1290]
[Detaching after vfork from child process 1291]
[Detaching after vfork from child process 1292]
[Detaching after vfork from child process 1293]

(emacs:1267): Gdk-ERROR **: 11:50:20.289: The program 'emacs' received
an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
  (Details: serial 7979 error_code 3 request_code 25 (core protocol)
minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

Thread 1 "emacs" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff6f2c855 in ?? () from /usr/lib64/libglib-2.0.so.0
(gdb) thread apply all bt

Thread 3 (Thread 0x7ffff1bd2700 (LWP 1274)):
#0  0x00007ffff5121e9f in poll () at /lib64/libc.so.6
#1  0x00007ffff6f26cee in  () at /usr/lib64/libglib-2.0.so.0
#2  0x00007ffff6f27053 in g_main_loop_run () at /usr/lib64/libglib-2.0.so.0
#3  0x00007ffff715c666 in  () at /usr/lib64/libgio-2.0.so.0
#4  0x00007ffff6f4e98d in  () at /usr/lib64/libglib-2.0.so.0
#5  0x00007ffff56ef06b in start_thread () at /lib64/libpthread.so.0
#6  0x00007ffff512d72f in clone () at /lib64/libc.so.6

Thread 2 (Thread 0x7ffff2bf2700 (LWP 1270)):
#0  0x00007ffff5121e9f in poll () at /lib64/libc.so.6
#1  0x00007ffff6f26cee in  () at /usr/lib64/libglib-2.0.so.0
#2  0x00007ffff6f26e0f in g_main_context_iteration () at
/usr/lib64/libglib-2.0.so.0
#3  0x00007ffff6f26e61 in  () at /usr/lib64/libglib-2.0.so.0
#4  0x00007ffff6f4e98d in  () at /usr/lib64/libglib-2.0.so.0
#5  0x00007ffff56ef06b in start_thread () at /lib64/libpthread.so.0
#6  0x00007ffff512d72f in clone () at /lib64/libc.so.6

--Type <RET> for more, q to quit, c to continue without paging--c
Thread 1 (Thread 0x7ffff36acc80 (LWP 1267)):
#0  0x00007ffff6f2c855 in  () at /usr/lib64/libglib-2.0.so.0
#1  0x00007ffff6f2efac in g_log_writer_default () at /usr/lib64/libglib-2.0.so.0
#2  0x00007ffff6f2d417 in g_log_structured_array () at
/usr/lib64/libglib-2.0.so.0
#3  0x00007ffff6f2dd80 in g_log_structured_standard () at
/usr/lib64/libglib-2.0.so.0
#4  0x00007ffff745ba66 in  () at /usr/lib64/libgdk-3.so.0
#5  0x00007ffff7468263 in  () at /usr/lib64/libgdk-3.so.0
#6  0x00007ffff6db3827 in _XError () at /usr/lib64/libX11.so.6
#7  0x00007ffff6db0797 in  () at /usr/lib64/libX11.so.6
#8  0x00007ffff6db0825 in  () at /usr/lib64/libX11.so.6
#9  0x00007ffff6db16ed in _XReply () at /usr/lib64/libX11.so.6
#10 0x00007ffff6d98450 in XGetWindowProperty () at /usr/lib64/libX11.so.6
#11 0x00007ffff745d4b6 in  () at /usr/lib64/libgdk-3.so.0
#12 0x00007ffff74632a9 in  () at /usr/lib64/libgdk-3.so.0
#13 0x00007ffff7462d9c in  () at /usr/lib64/libgdk-3.so.0
#14 0x00007ffff742d030 in gdk_display_get_event () at /usr/lib64/libgdk-3.so.0
#15 0x00007ffff7462a32 in  () at /usr/lib64/libgdk-3.so.0
#16 0x00007ffff6f26b2d in g_main_context_dispatch () at
/usr/lib64/libglib-2.0.so.0
#17 0x00007ffff6f26d80 in  () at /usr/lib64/libglib-2.0.so.0
#18 0x00007ffff6f26e0f in g_main_context_iteration () at
/usr/lib64/libglib-2.0.so.0
#19 0x00007ffff76fb105 in gtk_main_iteration () at /usr/lib64/libgtk-3.so.0
#20 0x00000000004cabf3 in XTread_socket (terminal=<optimized out>,
hold_quit=0x7fffffffc970) at /usr/src/emacs/src/xterm.c:9386
#21 0x00000000004fd5f2 in gobble_input () at /usr/src/emacs/src/keyboard.c:6891
#22 0x00000000004fdb95 in handle_async_input () at
/usr/src/emacs/src/keyboard.c:7128
#23 0x00000000004fdb95 in process_pending_signals () at
/usr/src/emacs/src/keyboard.c:7142
#24 0x0000000000572d6b in list_length (list=0x2329b43) at
/usr/src/emacs/src/lisp.h:1449
#25 0x0000000000572ea8 in Flength (sequence=<optimized out>) at
/usr/src/emacs/src/fns.c:129
#26 0x000000000057300d in concat (nargs=1, args=0x7fffffffcb08,
target_type=Lisp_Cons, last_special=<optimized out>) at
/usr/src/emacs/src/fns.c:680
#27 0x0000000000573d33 in Fcopy_sequence (arg=<optimized out>) at
/usr/src/emacs/src/lisp.h:745
#28 0x00000000004fc83c in timer_check () at /usr/src/emacs/src/keyboard.c:4387
#29 0x00000000004fcd45 in readable_events (flags=flags@entry=1) at
/usr/src/emacs/src/keyboard.c:3397
#30 0x00000000004fd758 in get_input_pending (flags=flags@entry=1) at
/usr/src/emacs/src/keyboard.c:6809
#31 0x0000000000500638 in detect_input_pending_run_timers
(do_display=do_display@entry=true) at
/usr/src/emacs/src/keyboard.c:10367
#32 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 /usr/src/emacs/src/process.c:5707
#33 0x000000000042d82f in sit_for (timeout=timeout@entry=0x3e,
reading=reading@entry=true, display_option=display_option@entry=1) at
/usr/src/emacs/src/lisp.h:1032
#34 0x00000000005032e8 in read_char (commandflag=1, map=0x2f52f23,
prev_event=0x0, used_mouse_menu=0x7fffffffd6ab, end_time=0x0) at
/usr/src/emacs/src/lisp.h:1147
#35 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
/usr/src/emacs/src/keyboard.c:9553
#36 0x0000000000504e8e in command_loop_1 () at /usr/src/emacs/src/lisp.h:1032
#37 0x0000000000568d37 in internal_condition_case
(bfun=bfun@entry=0x504cb0 <command_loop_1>,
handlers=handlers@entry=0x90, hfun=hfun@entry=0x4fbee0 <cmd_error>) at
/usr/src/emacs/src/eval.c:1355
#38 0x00000000004f6cfc in command_loop_2 (ignore=ignore@entry=0x0) at
/usr/src/emacs/src/lisp.h:1032
#39 0x0000000000568c91 in internal_catch (tag=tag@entry=0xd4d0,
func=func@entry=0x4f6ce0 <command_loop_2>, arg=arg@entry=0x0) at
/usr/src/emacs/src/eval.c:1116
#40 0x00000000004f6ca4 in command_loop () at /usr/src/emacs/src/lisp.h:1032
#41 0x00000000004fbaf6 in recursive_edit_1 () at
/usr/src/emacs/src/keyboard.c:714
#42 0x00000000004fbe20 in Frecursive_edit () at
/usr/src/emacs/src/keyboard.c:786
#43 0x0000000000423f25 in main (argc=1, argv=0x7fffffffdba8) at
/usr/src/emacs/src/emacs.c:2054
#44 0x00007ffff503ae5b in __libc_start_main () at /lib64/libc.so.6
#45 0x00000000004245ca in _start () at
/root/glibc-2a0c65c5167af50893952729ba38cc68/glibc-2.30/csu/../sysdeps/x86_64/start.S:120
(gdb)

пн, 13 янв. 2020 г. в 08:03, Vladimir Nikishkin <[email-masked]>:
>
> It's not really predictable. I didn't manage to reproduce the crash under gdb so far, although without gdb it sometimes crashes and sometimes hands under similar conditions. I'll keep running Emacs under gdb and if a crash occurs, will post it here.
>
> Eli Zaretskii <[email-masked]> 於 2020年1月12日 週日 23:08 寫道：
>>
>> > From: Vladimir Nikishkin <[email-masked]>
>> > Date: Sun, 12 Jan 2020 14:49:12 +0800
>> > Cc: [email-masked]
>> >
>> > 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:
>>
>> Previously, you said that this unoptimized build "crashed, printing
>> This is GTK bug".  But I don't seed any crash here, just interrupted
>> Emacs because you typed C-c.  Does this mean you cannot reproduce the
>> crash under GDB?

-- 
Yours sincerely, Vladimir Nikishkin