Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 63864 invoked from network); 25 May 2007 09:37:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 May 2007 09:37:37 -0000 Received: (qmail 54561 invoked by uid 500); 25 May 2007 09:37:42 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 54467 invoked by uid 500); 25 May 2007 09:37:42 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 54458 invoked by uid 99); 25 May 2007 09:37:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2007 02:37:42 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2007 02:37:36 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 750BC714063 for ; Fri, 25 May 2007 02:37:16 -0700 (PDT) Message-ID: <2715060.1180085836476.JavaMail.jira@brutus> Date: Fri, 25 May 2007 02:37:16 -0700 (PDT) From: "Xiao-Feng Li (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-3956) [drlvm][thread] memory leak in thread pool implementation In-Reply-To: <32921287.1180008976346.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-3956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499003 ] Xiao-Feng Li commented on HARMONY-3956: --------------------------------------- I think it is a duplicate. I will close it with a link to H3289. -- http://xiao-feng.blogspot.com > [drlvm][thread] memory leak in thread pool implementation > --------------------------------------------------------- > > Key: HARMONY-3956 > URL: https://issues.apache.org/jira/browse/HARMONY-3956 > Project: Harmony > Issue Type: Bug > Components: DRLVM > Environment: Linux > Reporter: Yu-Nan He > > I found a very interesting design issue in threading part about the thread pool implementation. This introduces memory leaks and sometimes fails classlib tests. This can be a potential issue for server side applications. > The current thread pool is implemented through WeakReference( ThreadWeakRef ), i.e., each created Java thread will be managed with a WeakReference, and the reference object will be put into the referenceQueue when the thread exits. But the enqueuing of the finished thread depends on WeakReference processing of the JVM, hence depending on the GC collection cycle. If GC has large enough free space, not to collect the heap and process WeakReference, the finished threads will not be returned to the referenceQueue. It is possible that, lots of finished threads are not enqueued before a GC happen, gradually running out native memory for new thread creation. > > To work around this issue, TM can trigger GC from time to time when the referenceQueue is empty. But I guess a right solution is to use some other mechanism for thread pool implementation. Since thread entity is scare resource for the system, we probably donot want to depend its management on the WeakReference processing, since there is no specified behavior on the timing of WeakReference processing. This is the key issue. That means, even the TM triggers GC from time to time, we cannot guarantee the finished threads will be enqueued on time before system crashes. > In my experiments in Linux32, I found classlib tests (run "ant test" in working_classlib) failed from time to time due to this issue. The error message is new thread cannot be created. > It would be great if the threading guys can think of some good solution for this issue. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.