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]

Submitter:  Ludovic Courtès <civodul>
Submitted:  Tue 20 Apr 2010 09:02:07 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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

Fixed by commit e9bac3be613f549b932d58913307ae18c89b9ffe.

Ludovic Courtès <civodul>
Group 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>
Group 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>
Group 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>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-10-11 civodul StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code