Subject: bug#23435: Mysterious SIGABRT

From: Christopher Allan Webber <[email-masked]>
Date: Tue, 03 May 2016 15:31:17 -0500

In the actor model subsystem I have in 8sync things are a bit tricky...
I have a prompt layered on a prompt, and beyond the first prompt is a
catch-all that prevents the event loop from crashing things (it just
prints the error and continues).

However, there's a circumstance where if I abort to a prompt on the
inner prompt, store the delimited continuation until I'm ready to resume
it again, resume it, and then within the thing I resume, raise *any sort
of error*... well, I get a SIGABRT.

Some things of note:
 - If I don't try to catch the error outside of the prompt, I don't get
   a SIGABRT.  I can catch it within the second prompt and it's fine.
 - The pre-unwind-handler still works fine.

I haven't been able to figure out how to make a more minimalist example,
but this happens consistently, and makes it so my async programs grind
to a halt in a way I would prefer they didn't (part of the goal of the
actor model is that it's friendly towards some actors erroring out, in
theory...)

Running gdb on the core gives me the following:

Thread 4 (Thread 0x7f504bfff700 (LWP 11900)):
#0  0x00007f505312efcd in read ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libpthread.so.0
#1  0x00007f5053661997 in read_signal_pipe_data ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#2  0x00007f505335d093 in GC_do_blocking_inner ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#3  0x00007f505335194c in GC_with_callee_saves_pushed ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#4  0x00007f505335742c in GC_do_blocking ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#5  0x00007f505368422a in scm_without_guile ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#6  0x00007f50536618ff in signal_delivery_thread ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#7  0x00007f5053697335 in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#8  0x00007f505361035e in scm_call_3 ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#9  0x00007f505368657e in scm_internal_catch ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#10 0x00007f505368466c in really_spawn ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#11 0x00007f50536069ca in c_body ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#12 0x00007f5053697335 in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#13 0x00007f50536103a3 in scm_call_4 ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#14 0x00007f5053607141 in scm_i_with_continuation_barrier ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#15 0x00007f50536071d5 in scm_c_with_continuation_barrier ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#16 0x00007f5053683dcc in with_guile_and_parent ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#17 0x00007f50533573f2 in GC_call_with_stack_base ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#18 0x00007f50536837dc in spawn_thread ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#19 0x00007f505335c34e in GC_inner_start_routine ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#20 0x00007f50533573f2 in GC_call_with_stack_base ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#21 0x00007f5053126464 in start_thread ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libpthread.so.0
#22 0x00007f5051b005cd in clone ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libc.so.6

Thread 3 (Thread 0x7f505080d700 (LWP 11899)):
#0  0x00007f5051af9313 in select ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libc.so.6
#1  0x00007f5053616c93 in scm_select ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#2  0x00007f505369678f in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#3  0x00007f505361035e in scm_call_3 ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#4  0x00007f50536845c5 in really_launch ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#5  0x00007f50536069ca in c_body ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#6  0x00007f5053697335 in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#7  0x00007f50536103a3 in scm_call_4 ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#8  0x00007f5053607141 in scm_i_with_continuation_barrier ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#9  0x00007f50536071d5 in scm_c_with_continuation_barrier ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#10 0x00007f5053683dcc in with_guile_and_parent ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#11 0x00007f50533573f2 in GC_call_with_stack_base ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#12 0x00007f505368378c in launch_thread ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#13 0x00007f505335c34e in GC_inner_start_routine ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#14 0x00007f50533573f2 in GC_call_with_stack_base ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#15 0x00007f5053126464 in start_thread ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libpthread.so.0
#16 0x00007f5051b005cd in clone ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libc.so.6

Thread 2 (Thread 0x7f5051a16700 (LWP 11898)):
#0  0x00007f505312c07f in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libpthread.so.0
#1  0x00007f505335dd97 in GC_wait_marker ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#2  0x00007f50533546ba in GC_help_marker ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#3  0x00007f505335c40c in GC_mark_thread ()
   from /gnu/store/my4az71gz8iqd4w8kb34kq7vlk3fcvhm-libgc-7.4.2/lib/libgc.so.1
#4  0x00007f5053126464 in start_thread ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libpthread.so.0
#5  0x00007f5051b005cd in clone ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libc.so.6

Thread 1 (Thread 0x7f5053b51740 (LWP 11897)):
#0  0x00007f5051a4a4d7 in raise ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libc.so.6
#1  0x00007f5051a4b95a in abort ()
   from /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22/lib/libc.so.6
#2  0x00007f5053689878 in vm_error_stack_overflow ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#3  0x00007f505368a86d in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#4  0x00007f50536a1438 in scm_call_with_vm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#5  0x00007f505360d665 in scm_error_scm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#6  0x00007f505360d71f in scm_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#7  0x00007f505360db42 in scm_misc_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#8  0x00007f5053606602 in scm_c_abort ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#9  0x00007f5053689741 in vm_abort ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#10 0x00007f505368ff35 in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#11 0x00007f50536a1438 in scm_call_with_vm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#12 0x00007f505360d665 in scm_error_scm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#13 0x00007f505360d71f in scm_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#14 0x00007f505360db42 in scm_misc_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#15 0x00007f5053606602 in scm_c_abort ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#16 0x00007f5053689741 in vm_abort ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#17 0x00007f505368ff35 in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#18 0x00007f50536a1438 in scm_call_with_vm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#19 0x00007f505360d665 in scm_error_scm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#20 0x00007f505360d71f in scm_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#21 0x00007f505360db42 in scm_misc_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#22 0x00007f5053606602 in scm_c_abort ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#23 0x00007f5053689741 in vm_abort ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#24 0x00007f505368ff35 in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#25 0x00007f50536a1438 in scm_call_with_vm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#26 0x00007f505360d665 in scm_error_scm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#27 0x00007f505360d71f in scm_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#28 0x00007f505360db42 in scm_misc_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#29 0x00007f5053606602 in scm_c_abort ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#30 0x00007f5053689741 in vm_abort ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#31 0x00007f505368ff35 in vm_debug_engine ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#32 0x00007f50536a1438 in scm_call_with_vm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#33 0x00007f505360d665 in scm_error_scm ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#34 0x00007f505360d71f in scm_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22
#35 0x00007f505360db42 in scm_misc_error ()
   from /gnu/store/hyk2i7b8mwbrbiyqk5sgrfgds9zvcrn5-guile-2.0.11/lib/libguile-2.0.so.22

.... this last part keeps going on for at least 11k more lines and then
I gave up on printing it.

If I can come up with a more minimalist reproduction of this bug, I'll
attach it.  I can't figure out how to reproduce it outside of my
complicated machine yet, though. :)