bugGuile - Bugs: bug #27450, Fat mutexes not GC'd until their...

 
 

bug #27450: Fat mutexes not GC'd until their owner dies

Submitted by:  Ludovic Courtès <civodul>
Submitted on:  Mon 14 Sep 2009 10:32:47 PM 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.

 

Tue 15 Sep 2009 10:19:51 PM UTC, comment #1:

Fixed:
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=a0faf7ddf9e260916aa1e64cc2ec48ac6925b2d6 .

Ludovic Courtès <civodul>
Project Administrator
Mon 14 Sep 2009 10:32:47 PM UTC, original submission:

Hello,

In 1.9.2 and earlier (pre-libgc), the following snippet demonstrates in a few seconds that threads aren't GC'd, despite the fact that `(all-threads)' shows the right number of threads:

#v+
(use-modules (ice-9 threads))

(let loop ()
(let* ((m (make-mutex))
(t (begin
(lock-mutex m)
(make-thread (lambda args
(lock-mutex m)
args)))))
(cancel-thread t)

(format #t "~A threads~%" (length (all-threads)))

(loop)))
#v-

This is because threads here are canceled while waiting in `block_self ()'. Threads in `block_self ()' are enqueued in the given queue, which is associated with the fat mutex. Cancellation does not give them the opportunity to get removed from the queue, hence the unbounded data retention.

But the root cause is that mutexes created in this code aren't GC'd, because they are associated with the calling thread via `t->mutexes'. One solution would be to use weak pointers in `t->mutexes'.

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
    Tue 15 Sep 2009 10:19:51 PM UTCcivodulStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1