From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Newsgroups: gmane.lisp.guile.bugs Subject: [bug #27450] Fat mutexes not GC'd until their owner dies Date: Mon, 14 Sep 2009 22:32:48 +0000 Message-ID: <20090914-223247.sv15145.87060@savannah.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=UTF-8 X-Trace: ger.gmane.org 1252967588 23510 80.91.229.12 (14 Sep 2009 22:33:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Sep 2009 22:33:08 +0000 (UTC) To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= , bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Sep 15 00:33:01 2009 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MnK6W-0007Fp-Vv for guile-bugs@m.gmane.org; Tue, 15 Sep 2009 00:33:01 +0200 Original-Received: from localhost ([127.0.0.1]:54012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnK6W-0005q9-8I for guile-bugs@m.gmane.org; Mon, 14 Sep 2009 18:33:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnK6P-0005kg-VQ for bug-guile@gnu.org; Mon, 14 Sep 2009 18:32:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnK6P-0005jX-El for bug-guile@gnu.org; Mon, 14 Sep 2009 18:32:53 -0400 Original-Received: from [199.232.76.173] (port=48478 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnK6P-0005jB-7x for bug-guile@gnu.org; Mon, 14 Sep 2009 18:32:53 -0400 Original-Received: from savannah.gnu.org ([199.232.41.3]:54163 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MnK6N-0007i6-6i; Mon, 14 Sep 2009 18:32:51 -0400 Original-Received: from savannah.gnu.org ([199.232.41.3]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1MnK6L-0005P4-3A; Mon, 14 Sep 2009 22:32:49 +0000 Original-Received: from www-data by savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1MnK6K-0005P1-U5; Mon, 14 Sep 2009 22:32:48 +0000 X-Savane-Server: savannah.gnu.org:443 [199.232.41.3] X-Savane-Project: guile X-Savane-Tracker: bugs X-Savane-Item-ID: 27450 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.2) Gecko/20090809 IceCat/3.5.2 X-Apparently-From: 78.251.13.105 (Savane authenticated user civodul) Original-References: In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:4317 Archived-At: URL: 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: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/