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

 
 

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

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

Tue 15 Sep 2009 10:19:51 PM UTC, comment #1: 
Ludovic Courtès <civodul>
Group 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>
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
    2009-09-15 civodul StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code