unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [bug #27450] Fat mutexes not GC'd until their owner dies
@ 2009-09-14 22:32 Ludovic Courtès
  2009-09-15 22:19 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2009-09-14 22:32 UTC (permalink / raw)
  To: Ludovic Courtès, bug-guile


URL:
  <http://savannah.gnu.org/bugs/?27450>

                 Summary: Fat mutexes not GC'd until their owner dies
                 Project: Guile
            Submitted by: civodul
            Submitted on: Mon 14 Sep 2009 10:32:47 PM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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'.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?27450>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [bug #27450] Fat mutexes not GC'd until their owner dies
  2009-09-14 22:32 [bug #27450] Fat mutexes not GC'd until their owner dies Ludovic Courtès
@ 2009-09-15 22:19 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2009-09-15 22:19 UTC (permalink / raw)
  To: Ludovic Courtès, bug-guile


Update of bug #27450 (project guile):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?27450>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-15 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-14 22:32 [bug #27450] Fat mutexes not GC'd until their owner dies Ludovic Courtès
2009-09-15 22:19 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).