guile-devel
[Top][All Lists]
Advanced

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

‘equal?’ should not run asyncs


From: Ludovic Courtès
Subject: ‘equal?’ should not run asyncs
Date: Thu, 07 Oct 2010 15:39:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hello!

I just hit this dead lock:

--8<---------------cut here---------------start------------->8---
(gdb) bt
#0  0x00007f20d495d114 in __lll_lock_wait () from 
/home/ludo/.nix-profile/lib/libpthread.so.0
#1  0x00007f20d4958349 in _L_lock_1004 () from 
/home/ludo/.nix-profile/lib/libpthread.so.0
#2  0x00007f20d495815e in pthread_mutex_lock () from 
/home/ludo/.nix-profile/lib/libpthread.so.0
#3  0x00007f20d4b80685 in GC_core_malloc (lb=1728) at malloc.c:273
#4  0x00007f20d550a3a0 in scm_i_vm_capture_stack (stack_base=0xbc3008, 
fp=<value optimized out>,
    sp=0xbc36c0, ra=0x7f20d553beda "", mvra=<value optimized out>, flags=0) at 
vm.c:109
#5  0x00007f20d54f9d32 in scm_make_stack (obj=0x404, args=0x2f03060) at 
stacks.c:262
#6  0x00007f20d55122af in vm_debug_engine (vm=0xbc2340, program=0x2, 
argv=0xbc36c0,
    nargs=12334768) at vm-i-system.c:853
#7  0x00007f20d548805d in scm_async_click () at async.c:168
#8  0x00007f20d549a0aa in scm_equal_p (x=0x2e7af00, y=0x2f03070) at eq.c:277
#9  0x00007f20d5482b51 in scm_sloppy_assoc (key=0x2f03070, alist=0x2e7aef0) at 
alist.c:97
#10 0x00007f20d54afc27 in do_weak_bucket_assoc (data=0x7fff69413b40) at 
hashtab.c:170
#11 0x00007f20d4b7d271 in GC_call_with_alloc_lock (fn=0x7f20d54afba0 
<do_weak_bucket_assoc>,
    client_data=0x7fff69413b40) at finalize.c:925
#12 0x00007f20d54b023a in weak_bucket_assoc (table=0x1f19480, buckets=<value 
optimized out>,
    bucket_index=<value optimized out>, hash_fn=0x7f20d54afa60 <scm_ihash>,
    assoc=<value optimized out>, object=<value optimized out>, closure=0x0) at 
hashtab.c:201
#13 0x00007f20d54b08fd in scm_hash_fn_create_handle_x (table=0x1f19480, 
obj=0x2f03070, init=0x4,
    hash_fn=0x7f20d54afa60 <scm_ihash>, assoc_fn=0x7f20d5482b10 
<scm_sloppy_assoc>, closure=0x0)
    at hashtab.c:538
#14 0x00007f20d54b0bf3 in scm_hash_fn_set_x (table=0x1f19480, obj=<value 
optimized out>,
    val=0x1f18680, hash_fn=<value optimized out>, assoc_fn=<value optimized 
out>,
    closure=<value optimized out>) at hashtab.c:624
--8<---------------cut here---------------end--------------->8---

This is due to the fact that ‘equal?’ tries to run the VM, which tries
to allocate memory, while the allocation lock is held.  This violates
the restriction currently imposed on the ASSOC function called by
‘weak_bucket_assoc’.

I’m tempted to apply the patch below, on the grounds that asyncs are
already taken care of by the VM anyway:

--- a/libguile/eq.c
+++ b/libguile/eq.c
@@ -274,7 +274,6 @@ scm_equal_p (SCM x, SCM y)
 {
   SCM_CHECK_STACK;
  tailrecurse:
-  SCM_TICK;
   if (scm_is_eq (x, y))
     return SCM_BOOL_T;
   if (SCM_IMP (x))
WDYT?

Thanks,
Ludo’.

reply via email to

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