bugGuile - Bugs: bug #29616, Hang waiting for the GC lock while...

 
 

bug #29616: Hang waiting for the GC lock while traversing a weak hash table [1.9.10]

Submitted by:  Ludovic Courtès <civodul>
Submitted on:  Tue 20 Apr 2010 09:02:07 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 11 Oct 2010 05:01:36 PM UTC, comment #3:

Fixed by commit e9bac3be613f549b932d58913307ae18c89b9ffe.

Ludovic Courtès <civodul>
Project Administrator
Tue 20 Apr 2010 11:42:02 AM UTC, comment #2:

For the record, (ice-9 poe) uses this idiom (weak hash table with custom `assoc' and `hash' functions.)

Ludovic Courtès <civodul>
Project Administrator
Tue 20 Apr 2010 09:06:17 AM UTC, comment #1:

This should read "the `assoc' and `hash' functions can be user-defined".

Ludovic Courtès <civodul>
Project Administrator
Tue 20 Apr 2010 09:02:07 AM UTC, original submission:

Buckets of weak hash tables are traversed with the GC allocation lock held. However, the `assoc' and `hash' function can be used defined and they can be Scheme procedures. When these Scheme procedures invoke the GC, they hang waiting for the allocation lock:

#v+
#0 0x00007fada32eb114 in __lll_lock_wait ()
from /nix/store/4jl83jgzaacf519h3wczgbjvqi91hfk6-glibc-2.11.1/lib/libpthread.so.0
#1 0x00007fada32e6349 in _L_lock_1004 ()
from /nix/store/4jl83jgzaacf519h3wczgbjvqi91hfk6-glibc-2.11.1/lib/libpthread.so.0
#2 0x00007fada32e615e in pthread_mutex_lock ()
from /nix/store/4jl83jgzaacf519h3wczgbjvqi91hfk6-glibc-2.11.1/lib/libpthread.so.0
#3 0x00007fada350eea9 in GC_generic_malloc_many (lb=48, k=<value optimized out>, result=0x7fada3732bc0)
at mallocx.c:284
#4 0x00007fada3517fd8 in GC_malloc_atomic (bytes=48) at thread_local_alloc.c:195
#5 0x00007fada3c37465 in make_hash_table (flags=0, k=<value optimized out>, func_name=<value optimized out>)
at hashtab.c:240
#6 0x00007fada3c9f0f0 in vm_debug_engine (vm=<value optimized out>, program=0x0, argv=<value optimized out>,
nargs=<value optimized out>) at vm-i-system.c:856
#7 0x00007fada3c37e26 in scm_c_run_hookn (hook=<value optimized out>, argv=0x7fff6703dc90, nargs=1) at hooks.c:285
#8 0x00007fada3c95f0b in vm_dispatch_hook (vm=<value optimized out>, hook_num=<value optimized out>) at vm.c:210
#9 0x00007fada3ca1ae2 in vm_debug_engine (vm=<value optimized out>, program=0x356c8280, argv=<value optimized out>,
nargs=<value optimized out>) at vm-i-system.c:781
#10 0x00007fada3c24f59 in scm_call_2 (proc=0x356c8180, arg1=<value optimized out>, arg2=<value optimized out>)
at eval.c:580
#11 0x00007fada3c35575 in do_weak_bucket_assoc (data=<value optimized out>) at hashtab.c:170
#12 0x00007fada350b271 in GC_call_with_alloc_lock (fn=0x7fada3c35540 <do_weak_bucket_assoc>,
client_data=0x7fff6703de50) at finalize.c:925
#13 0x00007fada3c3691a in weak_bucket_assoc (table=0x356c8580, buckets=<value optimized out>, bucket_index=0,
hash_fn=0xffffffffffffffff, assoc=0x7fada3732300 <GC_allocate_ml>, object=0xe8c, closure=0x7fff6703df20)
at hashtab.c:201
#14 0x00007fada3c36ae5 in scm_hash_fn_get_handle (table=0x356c8580, obj=0x358b2f60,
hash_fn=0x7fada3c36670 <scm_ihashx>, assoc_fn=0x7fada3c36630 <scm_sloppy_assx>, closure=0x7fff6703df20)
at hashtab.c:503
#15 0x00007fada3c36baf in scm_hashx_get_handle (hash=0xfffffffffffffe00, assoc=<value optimized out>,
table=0x7fada3732300, key=0x80) at hashtab.c:974
#v-

Reproduce with:

#v+
scheme@(guile-user)> (define t (make-doubly-weak-hash-table 12))
scheme@(guile-user)> (hashx-ref (lambda (obj n) (gc) (hash obj n)) (lambda (obj alist) (gc) (assoc obj alist)) t 'foo)
#v-

Ludo'.

Ludovic Courtès <civodul>
Project Administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by civodul (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 11 Oct 2010 05:01:36 PM UTCcivodulStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1