guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug #27457 (“Threads, mutexes, and critical sections”)


From: Ludovic Courtès
Subject: Bug #27457 (“Threads, mutexes, and critical sections”)
Date: Tue, 29 Sep 2009 01:21:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hi Neil,

Neil Jerram <address@hidden> writes:

> address@hidden (Ludovic Courtès) writes:
>
>> Hi,
>>
>> Neil Jerram <address@hidden> writes:
>>
>>> address@hidden (Ludovic Courtès) writes:
>>
>>>> This must be related to http://savannah.gnu.org/bugs/?27457 .
>>>> Contributions welcome!  ;-)
>>>
>>> I will start looking at this later this evening.  (Unless you're already
>>> investigating - in which case please let me know!)
>>
>> I won’t look into it in the next days, so go ahead!  ;-)
>
> Well...  I don't see the throw from critical section problem.  Instead,
> after a while, I see a hang, with one thread doing:
>
> #0  0xb7f06424 in __kernel_vsyscall ()
> #1  0xb7acd255 in sem_wait@@GLIBC_2.1 () from /lib/i686/cmov/libpthread.so.0
> #2  0xb7dc2018 in GC_stop_world () from /usr/lib/libgc.so.1
>
> and all the others:
>
> #0  0xb7f06424 in __kernel_vsyscall ()
> #1  0xb7b05837 in sigsuspend () from /lib/i686/cmov/libc.so.6
> #2  0xb7dc222b in GC_suspend_handler_inner () from /usr/lib/libgc.so.1
> #3  0xb7dc22b5 in GC_suspend_handler () from /usr/lib/libgc.so.1
> #4  <signal handler called>
>
> In theory, each other thread must have called sem_post(), and the number
> of those sem_post()s should be the same as the number of times that the
> GC_stop_world thread calls sem_wait(), and so the GC_stop_world thread
> shouldn't be waiting.

I should have mentioned this one:
http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/3185 .

This is normally somewhat fixed in current BDW-GC CVS, but Guile itself
may have troubles of its own dealing with cancellation.

The critical section issue should be orthogonal, though.

> Regarding the throw from critical section problem, I guess I'm not
> seeing this because of not running on a multi-core machine.  Can someone
> who does see this problem
>
> - run under GDB
> - set a breakpoint on the fprintf (stderr, "throw from within critical
>   section.\n") line in throw.c
> - post the thread backtraces (thread apply all bt), when this breakpoint
>   is hit?

Here it is:

--8<---------------cut here---------------start------------->8---
Breakpoint 1, scm_ithrow (key=0x707060, args=0x404, noreturn=1) at throw.c:746
(gdb) thread apply all bt

Thread 564 (Thread 0x7f90c0d20950 (LWP 18603)):
#0  0x00007f90c6f3077a in times () from 
/nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
#1  0x00007f90c85308cc in scm_c_get_internal_run_time () at stime.c:106
#2  0x00007f90c85439ec in vm_debug_engine (vp=0x7f90c0d1f860, 
program=0x7f90c0d1f860, argv=0x0, nargs=<value optimized out>) at vm-engine.c:59
#3  0x00007f90c853a751 in scm_c_with_throw_handler (tag=0x8e90c0, body=<value 
optimized out>, body_data=0x7f90c0d1fa50, handler=<value optimized out>, 
handler_data=<value optimized out>, lazy_catch_p=<value optimized out>) at 
throw.c:318
#4  0x00007f90c853a845 in scm_with_throw_handler (key=0x7f90c0d1f860, 
thunk=<value optimized out>, handler=0xc18da0) at throw.c:665
#5  0x00007f90c8545861 in vm_debug_engine (vp=0x703500, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#6  0x00007f90c853abc5 in scm_c_catch (tag=<value optimized out>, body=<value 
optimized out>, body_data=<value optimized out>, handler=<value optimized out>, 
handler_data=<value optimized out>, pre_unwind_handler=0, 
pre_unwind_handler_data=0x7f90c0d1fd60) at throw.c:243
#7  0x00007f90c853ad4e in scm_catch_with_pre_unwind_handler 
(key=0x7f90c0d1f860, thunk=<value optimized out>, handler=0xa2c900, 
pre_unwind_handler=0x204) at throw.c:627
#8  0x00007f90c853939b in really_launch (d=0x7fff794861b0) at threads.c:801
#9  0x00007f90c84d04aa in c_body (d=0x7f90c0d20000) at continuations.c:318
#10 0x00007f90c853abc5 in scm_c_catch (tag=<value optimized out>, body=<value 
optimized out>, body_data=<value optimized out>, handler=<value optimized out>, 
handler_data=<value optimized out>, pre_unwind_handler=0x7f90c8539fc0 
<scm_handle_by_message_noexit>, pre_unwind_handler_data=0x0) at throw.c:243
#11 0x00007f90c84d08d7 in scm_i_with_continuation_barrier (body=<value 
optimized out>, body_data=<value optimized out>, handler=0x7f90c84d04c0 
<c_handler>, handler_data=0x7f90c0d20000, pre_unwind_handler=<value optimized 
out>, pre_unwind_handler_data=<value optimized out>) at continuations.c:294
#12 0x00007f90c84d0970 in scm_c_with_continuation_barrier (func=<value 
optimized out>, data=<value optimized out>) at continuations.c:336
#13 0x00007f90c8539972 in scm_i_with_guile_and_parent (func=<value optimized 
out>, data=<value optimized out>, parent=<value optimized out>) at threads.c:709
#14 0x00007f90c8539a13 in launch_thread (d=0x7fff794861b0) at threads.c:814
#15 0x00007f90c7ffddb2 in GC_inner_start_routine (sb=<value optimized out>, 
arg=<value optimized out>) at ../pthread_support.c:1153
#16 0x00007f90c7ff7af5 in GC_call_with_stack_base (fn=0x66b61bdc, 
arg=0x7f90c0d1f860) at ../misc.c:1323
#17 0x00007f90c7dcaf97 in start_thread () from 
/nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libpthread.so.0
#18 0x00007f90c6f6156d in clone () from 
/nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6

Thread 2 (Thread 0x7f90c61c0950 (LWP 18001)):
#0  0x00007f90c7dd191b in read () from 
/nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libpthread.so.0
#1  0x00007f90c85182b3 in signal_delivery_thread (data=<value optimized out>) 
at scmsigs.c:164
#2  0x00007f90c853abc5 in scm_c_catch (tag=<value optimized out>, body=<value 
optimized out>, body_data=<value optimized out>, handler=<value optimized out>, 
handler_data=<value optimized out>, pre_unwind_handler=0, 
pre_unwind_handler_data=0x0) at throw.c:243
#3  0x00007f90c853adb4 in scm_internal_catch (tag=0x2c, body=0x7f90c61bfb8f, 
body_data=0x1, handler=0xffffffffffffffff, handler_data=0x7f90c8217520) at 
throw.c:257
#4  0x00007f90c85391ce in really_spawn (d=0x7fff79486dd0) at threads.c:891
#5  0x00007f90c84d04aa in c_body (d=0x7f90c61c0000) at continuations.c:318
#6  0x00007f90c853abc5 in scm_c_catch (tag=<value optimized out>, body=<value 
optimized out>, body_data=<value optimized out>, handler=<value optimized out>, 
handler_data=<value optimized out>, pre_unwind_handler=0x7f90c8539fc0 
<scm_handle_by_message_noexit>, pre_unwind_handler_data=0x0) at throw.c:243
#7  0x00007f90c84d08d7 in scm_i_with_continuation_barrier (body=<value 
optimized out>, body_data=<value optimized out>, handler=0x7f90c84d04c0 
<c_handler>, handler_data=0x7f90c61c0000, pre_unwind_handler=<value optimized 
out>, pre_unwind_handler_data=<value optimized out>) at continuations.c:294
#8  0x00007f90c84d0970 in scm_c_with_continuation_barrier (func=<value 
optimized out>, data=<value optimized out>) at continuations.c:336
#9  0x00007f90c8539972 in scm_i_with_guile_and_parent (func=<value optimized 
out>, data=<value optimized out>, parent=<value optimized out>) at threads.c:709
#10 0x00007f90c85399e3 in spawn_thread (d=0x7fff79486dd0) at threads.c:903
#11 0x00007f90c7ffddb2 in GC_inner_start_routine (sb=<value optimized out>, 
arg=<value optimized out>) at ../pthread_support.c:1153
#12 0x00007f90c7ff7af5 in GC_call_with_stack_base (fn=0xfffffffffffffe00, 
arg=0x7f90c61bfb8f) at ../misc.c:1323
#13 0x00007f90c7dcaf97 in start_thread () from 
/nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libpthread.so.0
#14 0x00007f90c6f6156d in clone () from 
/nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6

Thread 1 (Thread 0x7f90c89bd6f0 (LWP 17980)):
#0  scm_ithrow (key=0x707060, args=0x404, noreturn=1) at throw.c:746
#1  0x00007f90c84f00a0 in scm_i_gsubr_apply_list (self=0x707060, args=<value 
optimized out>) at gsubr.c:316
#2  0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#3  0x00007f90c84e4b90 in scm_c_with_fluid (fluid=0x6602c0, value=0x4, 
cproc=0x7f90c84e49e0 <apply_thunk>, cdata=0xc106c0) at fluids.c:382
#4  0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#5  0x00007f90c853abc5 in scm_c_catch (tag=<value optimized out>, body=<value 
optimized out>, body_data=<value optimized out>, handler=<value optimized out>, 
handler_data=<value optimized out>, pre_unwind_handler=0, 
pre_unwind_handler_data=0x7fff79486100) at throw.c:243
#6  0x00007f90c853ad4e in scm_catch_with_pre_unwind_handler (key=0x707060, 
thunk=<value optimized out>, handler=0xc10620, pre_unwind_handler=0x204) at 
throw.c:627
#7  0x00007f90c84f00a0 in scm_i_gsubr_apply_list (self=0x707060, args=<value 
optimized out>) at gsubr.c:316
#8  0x00007f90c8545ba6 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:689
#9  0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#10 0x00007f90c84e4b90 in scm_c_with_fluid (fluid=0x6c68e0, value=0x4, 
cproc=0x7f90c84e49e0 <apply_thunk>, cdata=0x8e80c0) at fluids.c:382
#11 0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#12 0x00007f90c84d4df3 in scm_dynamic_wind (in_guard=0x8e8280, thunk=0x8e82a0, 
out_guard=0x8e81c0) at dynwind.c:112
#13 0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#14 0x00007f90c853d60f in scm_vm_apply (vm=0x6ff1f0, program=0x8e84c0, 
args=0x404) at vm.c:406
#15 0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#16 0x00007f90c84d1122 in scm_sys_start_stack (id=0x104, thunk=0x8cfe20) at 
debug.c:483
#17 0x00007f90c8545ba6 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:689
#18 0x00007f90c853abc5 in scm_c_catch (tag=<value optimized out>, body=<value 
optimized out>, body_data=<value optimized out>, handler=<value optimized out>, 
handler_data=<value optimized out>, pre_unwind_handler=0, 
pre_unwind_handler_data=0x7fff79486c30) at throw.c:243
#19 0x00007f90c853ad4e in scm_catch_with_pre_unwind_handler (key=0x707060, 
thunk=<value optimized out>, handler=0x8cfe60, pre_unwind_handler=0x204) at 
throw.c:627
#20 0x00007f90c84f00a0 in scm_i_gsubr_apply_list (self=0x707060, args=<value 
optimized out>) at gsubr.c:316
#21 0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#22 0x00007f90c84d1122 in scm_sys_start_stack (id=0x104, thunk=0x8cc0a0) at 
debug.c:483
#23 0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#24 0x00007f90c853abc5 in scm_c_catch (tag=<value optimized out>, body=<value 
optimized out>, body_data=<value optimized out>, handler=<value optimized out>, 
handler_data=<value optimized out>, pre_unwind_handler=0x7f90c853a590 
<scm_handle_by_proc>, pre_unwind_handler_data=0x7fff794871f0) at throw.c:243
#25 0x00007f90c853ad4e in scm_catch_with_pre_unwind_handler (key=0x707060, 
thunk=<value optimized out>, handler=0xa58fc0, pre_unwind_handler=0x8c5de0) at 
throw.c:627
#26 0x00007f90c84f00a0 in scm_i_gsubr_apply_list (self=0x707060, args=<value 
optimized out>) at gsubr.c:316
#27 0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#28 0x00007f90c84d4df3 in scm_dynamic_wind (in_guard=0xa58120, thunk=0xa58100, 
out_guard=0xa580e0) at dynwind.c:112
#29 0x00007f90c8545861 in vm_debug_engine (vp=0x703f00, program=<value 
optimized out>, argv=<value optimized out>, nargs=<value optimized out>) at 
vm-i-system.c:605
#30 0x00007f90c84db73c in ceval (x=0x8b52c0, env=0x8b5220) at eval.i.c:1136
#31 0x00007f90c84e353a in scm_eval_x (exp=0x89b650, module_or_state=0x804720) 
at eval.c:4095
#32 0x00007f90c85195ff in scm_shell (argc=2, argv=0x7fff79487ae8) at 
script.c:771
#33 0x00007f90c84f611f in invoke_main_func (body_data=0x7fff794879e0) at 
init.c:378
#34 0x00007f90c84d04aa in c_body (d=0x7fff79487910) at continuations.c:318
#35 0x00007f90c853abc5 in scm_c_catch (tag=<value optimized out>, body=<value 
optimized out>, body_data=<value optimized out>, handler=<value optimized out>, 
handler_data=<value optimized out>, pre_unwind_handler=0x7f90c8539fc0 
<scm_handle_by_message_noexit>, pre_unwind_handler_data=0x0) at throw.c:243
#36 0x00007f90c84d08d7 in scm_i_with_continuation_barrier (body=<value 
optimized out>, body_data=<value optimized out>, handler=0x7f90c84d04c0 
<c_handler>, handler_data=0x7fff79487910, pre_unwind_handler=<value optimized 
out>, pre_unwind_handler_data=<value optimized out>) at continuations.c:294
#37 0x00007f90c84d0970 in scm_c_with_continuation_barrier (func=<value 
optimized out>, data=<value optimized out>) at continuations.c:336
#38 0x00007f90c8539972 in scm_i_with_guile_and_parent (func=<value optimized 
out>, data=<value optimized out>, parent=<value optimized out>) at threads.c:709
#39 0x00007f90c84f60d5 in scm_boot_guile (argc=<value optimized out>, 
argv=<value optimized out>, main_func=0x1, closure=0x1) at init.c:361
#40 0x0000000000400b50 in main (argc=7368800, argv=0x404) at guile.c:70
--8<---------------cut here---------------end--------------->8---

Hope this helps,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]