Subject: bug#32367: 2.2.4 hangs when a script uses a module that calls sigaction

From: Göran Weinholt <[email-masked]>
Date: Mon, 06 Aug 2018 11:54:31 +0200

Derek Upham <[email-masked]> writes:

> This is with guile-2.2 (2.2.4+1-1) and guile-2.2-libs (2.2.4+1-1) on
> Debian unstable, for the amd64 architecture.
...
>
>   % /usr/bin/guile -s foo 
>   setting SIGCHILD to SIG_DFL...
>   setting SIGCHILD to SIG_DFL...done

Here's a backtrace:

GNU gdb (Debian 8.1-4) 8.1
Copyright (C) 2018 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-linux-gnu".
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"...
Reading symbols from /usr/bin/guile...Reading symbols from /usr/lib/debug/.build-id/e3/f08708458c69f9adf32d6cafd6d9ca7a8410ea.debug...done.
done.
Attaching to program: /usr/bin/guile, process 29610
[New LWP 29611]
[New LWP 29612]
[New LWP 29613]
[New LWP 29614]
[New LWP 29615]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
s0x00007fb48c8f0e6c in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x559a855ebe60) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
88	  int err = lll_futex_timed_wait (futex_word, expected, NULL, private);
(gdb) set pagination off
(gdb) thread apply all bt

Thread 6 (Thread 0x7fb48891c700 (LWP 29615)):
#0  0x00007fb48c8f0e6c in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x559a855ebae0) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x559a8571ff80, cond=0x559a855ebab8) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=cond@entry=0x559a855ebab8, mutex=mutex@entry=0x559a8571ff80) at pthread_cond_wait.c:655
#3  0x00007fb48cb86bf5 in scm_pthread_cond_wait (cond=cond@entry=0x559a855ebab8, mutex=mutex@entry=0x559a8571ff80) at threads.c:1621
#4  0x00007fb48cb86dbb in block_self (queue=0x559a8571c2c0, mutex=mutex@entry=0x559a8571ff80, waittime=waittime@entry=0x0) at threads.c:316
#5  0x00007fb48cb86f6f in lock_mutex (current_thread=0x559a855eba80, waittime=0x0, m=0x559a8571ff80, kind=SCM_MUTEX_RECURSIVE) at threads.c:1037
#6  scm_timed_lock_mutex (mutex=0x559a8571c2b0, timeout=<optimized out>) at threads.c:1101
#7  0x00007fb48cb9353f in vm_regular_engine () at vm-engine.c:786
#8  0x00007fb48cb98d8f in scm_call_n () at vm.c:1257
#9  0x00007fb48cb1ab0f in scm_call_3 (proc=<optimized out>, arg1=arg1@entry=0x7fb489ee9050, arg2=arg2@entry=0x559a856abf40, arg3=arg3@entry=0x4) at eval.c:501
#10 0x00007fb48cb3d950 in scm_private_variable (module_name=0x7fb489ee9050, name=0x559a8565eb20) at modules.c:674
#11 0x00007fb48cb3da51 in scm_private_lookup (module_name=0x7fb489ee9050, name=0x559a8565eb20) at modules.c:717
#12 0x00007fb48cb97fd1 in vm_regular_engine () at vm-engine.c:2066
#13 0x00007fb48cb98d8f in scm_call_n () at vm.c:1257
#14 0x00007fb48cb86076 in really_launch (d=0x559a8592c6e0) at threads.c:794
#15 0x00007fb48cb14dfa in c_body (d=0x7fb48891be40) at continuations.c:422
#16 0x00007fb48cb9353f in vm_regular_engine () at vm-engine.c:786
#17 0x00007fb48cb98d8f in scm_call_n () at vm.c:1257
#18 0x00007fb48cb87784 in catch (tag=tag@entry=0x404, thunk=0x559a85937720, handler=0x559a859376e0, pre_unwind_handler=0x559a859376a0) at throw.c:137
#19 0x00007fb48cb87aa5 in scm_catch_with_pre_unwind_handler (key=key@entry=0x404, thunk=<optimized out>, handler=<optimized out>, pre_unwind_handler=<optimized out>) at throw.c:254
#20 0x00007fb48cb87c6f in scm_c_catch (tag=tag@entry=0x404, body=body@entry=0x7fb48cb14df0 <c_body>, body_data=body_data@entry=0x7fb48891be40, handler=handler@entry=0x7fb48cb15080 <c_handler>, handler_data=handler_data@entry=0x7fb48891be40, pre_unwind_handler=pre_unwind_handler@entry=0x7fb48cb14ed0 <pre_unwind_handler>, pre_unwind_handler_data=0x559a85689a20) at throw.c:377
#21 0x00007fb48cb153e0 in scm_i_with_continuation_barrier (body=body@entry=0x7fb48cb14df0 <c_body>, body_data=body_data@entry=0x7fb48891be40, handler=handler@entry=0x7fb48cb15080 <c_handler>, handler_data=handler_data@entry=0x7fb48891be40, pre_unwind_handler=pre_unwind_handler@entry=0x7fb48cb14ed0 <pre_unwind_handler>, pre_unwind_handler_data=0x559a85689a20) at continuations.c:360
#22 0x00007fb48cb15475 in scm_c_with_continuation_barrier (func=<optimized out>, data=<optimized out>) at continuations.c:456
#23 0x00007fb48cb86396 in with_guile (base=0x7fb48891bea8, data=0x7fb48891bed0) at threads.c:661
#24 0x00007fb48c4d04e8 in GC_call_with_stack_base () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#25 0x00007fb48cb8589d in scm_i_with_guile (dynamic_state=<optimized out>, data=0x559a8592c6e0, func=0x7fb48cb86000 <really_launch>) at threads.c:704
#26 launch_thread (d=0x559a8592c6e0) at threads.c:803
#27 0x00007fb48c8eaf2a in start_thread (arg=0x7fb48891c700) at pthread_create.c:463
#28 0x00007fb48c81dedf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7fb48999b700 (LWP 29614)):
#0  0x00007fb48c8f4394 in __libc_read (fd=5, buf=buf@entry=0x7fb48999aa40, nbytes=nbytes@entry=1) at ../sysdeps/unix/sysv/linux/read.c:27
#1  0x00007fb48cb240d7 in read (__nbytes=1, __buf=0x7fb48999aa40, __fd=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/unistd.h:44
#2  read_finalization_pipe_data (data=0x7fb48999aa40) at finalizers.c:199
#3  0x00007fb48c4d60c3 in GC_do_blocking_inner () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#4  0x00007fb48c4ca9ce in GC_with_callee_saves_pushed () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#5  0x00007fb48c4d051c in GC_do_blocking () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#6  0x00007fb48cb8677a in scm_without_guile (func=0x7fb48cb240c0 <read_finalization_pipe_data>, data=0x7fb48999aa40) at threads.c:722
#7  0x00007fb48cb2448b in finalization_thread_proc (unused=<optimized out>) at finalizers.c:212
#8  0x00007fb48cb14dfa in c_body (d=0x7fb48999ae40) at continuations.c:422
#9  0x00007fb48cb9353f in vm_regular_engine () at vm-engine.c:786
#10 0x00007fb48cb98d8f in scm_call_n () at vm.c:1257
#11 0x00007fb48cb87784 in catch (tag=tag@entry=0x404, thunk=0x559a85619860, handler=0x559a85619840, pre_unwind_handler=0x559a856197c0) at throw.c:137
#12 0x00007fb48cb87aa5 in scm_catch_with_pre_unwind_handler (key=key@entry=0x404, thunk=<optimized out>, handler=<optimized out>, pre_unwind_handler=<optimized out>) at throw.c:254
#13 0x00007fb48cb87c6f in scm_c_catch (tag=tag@entry=0x404, body=body@entry=0x7fb48cb14df0 <c_body>, body_data=body_data@entry=0x7fb48999ae40, handler=handler@entry=0x7fb48cb15080 <c_handler>, handler_data=handler_data@entry=0x7fb48999ae40, pre_unwind_handler=pre_unwind_handler@entry=0x7fb48cb14ed0 <pre_unwind_handler>, pre_unwind_handler_data=0x559a85689a20) at throw.c:377
#14 0x00007fb48cb153e0 in scm_i_with_continuation_barrier (body=body@entry=0x7fb48cb14df0 <c_body>, body_data=body_data@entry=0x7fb48999ae40, handler=handler@entry=0x7fb48cb15080 <c_handler>, handler_data=handler_data@entry=0x7fb48999ae40, pre_unwind_handler=pre_unwind_handler@entry=0x7fb48cb14ed0 <pre_unwind_handler>, pre_unwind_handler_data=0x559a85689a20) at continuations.c:360
#15 0x00007fb48cb15475 in scm_c_with_continuation_barrier (func=<optimized out>, data=<optimized out>) at continuations.c:456
#16 0x00007fb48cb86396 in with_guile (base=0x7fb48999aea8, data=0x7fb48999aed0) at threads.c:661
#17 0x00007fb48c4d04e8 in GC_call_with_stack_base () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#18 0x00007fb48cb86728 in scm_i_with_guile (dynamic_state=<optimized out>, data=<optimized out>, func=<optimized out>) at threads.c:704
#19 scm_with_guile (func=<optimized out>, data=<optimized out>) at threads.c:710
#20 0x00007fb48c8eaf2a in start_thread (arg=0x7fb48999b700) at pthread_create.c:463
#21 0x00007fb48c81dedf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7fb48a83d700 (LWP 29613)):
#0  0x00007fb48c8f0e6c in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fb48c6f4208) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7fb48c6f4260, cond=0x7fb48c6f41e0) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x7fb48c6f41e0, mutex=0x7fb48c6f4260) at pthread_cond_wait.c:655
#3  0x00007fb48c4d6de7 in GC_wait_marker () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#4  0x00007fb48c4cd6da in GC_help_marker () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#5  0x00007fb48c4d54bc in GC_mark_thread () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#6  0x00007fb48c8eaf2a in start_thread (arg=0x7fb48a83d700) at pthread_create.c:463
#7  0x00007fb48c81dedf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7fb48b03e700 (LWP 29612)):
#0  0x00007fb48c8f0e6c in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fb48c6f4208) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7fb48c6f4260, cond=0x7fb48c6f41e0) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x7fb48c6f41e0, mutex=0x7fb48c6f4260) at pthread_cond_wait.c:655
#3  0x00007fb48c4d6de7 in GC_wait_marker () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#4  0x00007fb48c4cd6da in GC_help_marker () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#5  0x00007fb48c4d54bc in GC_mark_thread () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#6  0x00007fb48c8eaf2a in start_thread (arg=0x7fb48b03e700) at pthread_create.c:463
#7  0x00007fb48c81dedf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7fb48b83f700 (LWP 29611)):
#0  0x00007fb48c8f0e6c in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fb48c6f4208) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7fb48c6f4260, cond=0x7fb48c6f41e0) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x7fb48c6f41e0, mutex=0x7fb48c6f4260) at pthread_cond_wait.c:655
#3  0x00007fb48c4d6de7 in GC_wait_marker () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#4  0x00007fb48c4cd6da in GC_help_marker () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#5  0x00007fb48c4d54bc in GC_mark_thread () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#6  0x00007fb48c8eaf2a in start_thread (arg=0x7fb48b83f700) at pthread_create.c:463
#7  0x00007fb48c81dedf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7fb48bc8e740 (LWP 29610)):
#0  0x00007fb48c8f0e6c in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x559a855ebe60) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x559a856e7f00, cond=0x559a855ebe38) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=cond@entry=0x559a855ebe38, mutex=mutex@entry=0x559a856e7f00) at pthread_cond_wait.c:655
#3  0x00007fb48cb86bf5 in scm_pthread_cond_wait (cond=cond@entry=0x559a855ebe38, mutex=mutex@entry=0x559a856e7f00) at threads.c:1621
#4  0x00007fb48cb86dbb in block_self (queue=0x559a8578f980, mutex=mutex@entry=0x559a856e7f00, waittime=waittime@entry=0x0) at threads.c:316
#5  0x00007fb48cb872cd in timed_wait (c=0x559a85757630, current_thread=0x559a855ebe00, current_thread=0x559a855ebe00, waittime=0x0, m=0x559a856e7f00, kind=SCM_MUTEX_STANDARD) at threads.c:1347
#6  scm_timed_wait_condition_variable (cond=0x559a8578f990, mutex=0x559a8578f960, timeout=0x904) at threads.c:1440
#7  0x00007fb48cb9353f in vm_regular_engine () at vm-engine.c:786
#8  0x00007fb48cb98d8f in scm_call_n () at vm.c:1257
#9  0x00007fb48cb1aaea in scm_call_2 (proc=<optimized out>, arg1=<optimized out>, arg2=<optimized out>) at eval.c:494
#10 0x00007fb48cb867c5 in scm_call_with_new_thread (thunk=<optimized out>, handler=<optimized out>) at threads.c:746
#11 0x00007fb48cb86816 in scm_spawn_thread (body=body@entry=0x7fb48cb66380 <signal_delivery_thread>, body_data=body_data@entry=0x0, handler=<optimized out>, handler_data=handler_data@entry=0x7fb48cbb63c5) at threads.c:844
#12 0x00007fb48cb66351 in start_signal_delivery_thread () at scmsigs.c:207
#13 0x00007fb48c8f2827 in __pthread_once_slow (once_control=0x7fb48cbf5ac8 <once>, init_routine=0x7fb48cb66310 <start_signal_delivery_thread>) at pthread_once.c:116
#14 0x00007fb48c8f28e5 in __GI___pthread_once (once_control=once_control@entry=0x7fb48cbf5ac8 <once>, init_routine=init_routine@entry=0x7fb48cb66310 <start_signal_delivery_thread>) at pthread_once.c:143
#15 0x00007fb48cb6668f in scm_i_ensure_signal_delivery_thread () at scmsigs.c:332
#16 scm_sigaction_for_thread (signum=<optimized out>, handler=0x2, flags=<optimized out>, thread=0x559a85622e90) at scmsigs.c:332
#17 0x00007fb48cb9353f in vm_regular_engine () at vm-engine.c:786
#18 0x00007fb48cb98d8f in scm_call_n () at vm.c:1257
#19 0x00007fb48cb38968 in scm_primitive_load_path (args=<optimized out>) at load.c:1248
#20 0x00007fb48cb9353f in vm_regular_engine () at vm-engine.c:786
#21 0x00007fb48cb98d8f in scm_call_n () at vm.c:1257
#22 0x00007fb48cb1bc07 in scm_primitive_eval (exp=<optimized out>, exp@entry=0x559a85735280) at eval.c:662
#23 0x00007fb48cb1bc63 in scm_eval (exp=0x559a85735280, module_or_state=module_or_state@entry=0x559a8571b140) at eval.c:696
#24 0x00007fb48cb67750 in scm_shell (argc=3, argv=0x7fff44ec9708) at script.c:454
#25 0x00007fb48cb3250d in invoke_main_func (body_data=0x7fff44ec95b0) at init.c:340
#26 0x00007fb48cb14dfa in c_body (d=0x7fff44ec94f0) at continuations.c:422
#27 0x00007fb48cb9353f in vm_regular_engine () at vm-engine.c:786
#28 0x00007fb48cb98d8f in scm_call_n () at vm.c:1257
#29 0x00007fb48cb87784 in catch (tag=tag@entry=0x404, thunk=0x559a85687140, handler=0x559a856870e0, pre_unwind_handler=0x559a856870c0) at throw.c:137
#30 0x00007fb48cb87aa5 in scm_catch_with_pre_unwind_handler (key=key@entry=0x404, thunk=<optimized out>, handler=<optimized out>, pre_unwind_handler=<optimized out>) at throw.c:254
#31 0x00007fb48cb87c6f in scm_c_catch (tag=tag@entry=0x404, body=body@entry=0x7fb48cb14df0 <c_body>, body_data=body_data@entry=0x7fff44ec94f0, handler=handler@entry=0x7fb48cb15080 <c_handler>, handler_data=handler_data@entry=0x7fff44ec94f0, pre_unwind_handler=pre_unwind_handler@entry=0x7fb48cb14ed0 <pre_unwind_handler>, pre_unwind_handler_data=0x559a85689a20) at throw.c:377
#32 0x00007fb48cb153e0 in scm_i_with_continuation_barrier (body=body@entry=0x7fb48cb14df0 <c_body>, body_data=body_data@entry=0x7fff44ec94f0, handler=handler@entry=0x7fb48cb15080 <c_handler>, handler_data=handler_data@entry=0x7fff44ec94f0, pre_unwind_handler=pre_unwind_handler@entry=0x7fb48cb14ed0 <pre_unwind_handler>, pre_unwind_handler_data=0x559a85689a20) at continuations.c:360
#33 0x00007fb48cb15475 in scm_c_with_continuation_barrier (func=<optimized out>, data=<optimized out>) at continuations.c:456
#34 0x00007fb48cb86396 in with_guile (base=0x7fff44ec9558, data=0x7fff44ec9580) at threads.c:661
#35 0x00007fb48c4d04e8 in GC_call_with_stack_base () from /usr/lib/x86_64-linux-gnu/libgc.so.1
#36 0x00007fb48cb86728 in scm_i_with_guile (dynamic_state=<optimized out>, data=data@entry=0x7fff44ec9580, func=func@entry=0x7fb48cb324f0 <invoke_main_func>) at threads.c:704
#37 scm_with_guile (func=func@entry=0x7fb48cb324f0 <invoke_main_func>, data=data@entry=0x7fff44ec95b0) at threads.c:710
#38 0x00007fb48cb326a2 in scm_boot_guile (argc=3, argv=0x7fff44ec9708, main_func=0x559a83f6e270 <inner_main>, closure=0x0) at init.c:323
#39 0x0000559a83f6e114 in main (argc=3, argv=0x7fff44ec9708) at guile.c:101

-- 
Göran Weinholt
Debian developer
73 de SA6CJK