Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 361A9200AC8 for ; Mon, 9 May 2016 07:54:33 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 34A26160A07; Mon, 9 May 2016 05:54:33 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7C7D6160A06 for ; Mon, 9 May 2016 07:54:32 +0200 (CEST) Received: (qmail 39129 invoked by uid 500); 9 May 2016 05:54:31 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 39113 invoked by uid 99); 9 May 2016 05:54:31 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 May 2016 05:54:31 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 0428CC06C9 for ; Mon, 9 May 2016 05:54:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -5.023 X-Spam-Level: X-Spam-Status: No, score=-5.023 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id CNUptbCBIcGL for ; Mon, 9 May 2016 05:54:29 +0000 (UTC) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 2E2505F472 for ; Mon, 9 May 2016 05:54:28 +0000 (UTC) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A1F8FC0AAB35 for ; Mon, 9 May 2016 05:54:21 +0000 (UTC) Received: from dhcp-10-40-4-101.brq.redhat.com (dhcp-10-40-4-255.brq.redhat.com [10.40.4.255]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u495sKkA030715 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 9 May 2016 01:54:21 -0400 Subject: Re: Leaking threads in the Artemis test suite To: dev@activemq.apache.org References: <01cff3a3-55f6-099d-e054-bea37ff5d4b7@redhat.com> <785389738.1105117.1462543187336.JavaMail.zimbra@redhat.com> From: Erich Duda Message-ID: Date: Mon, 9 May 2016 07:54:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <785389738.1105117.1462543187336.JavaMail.zimbra@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 archived-at: Mon, 09 May 2016 05:54:33 -0000 Justin, thank you for your respond. I have created the JIRA [1] and PR [2]. Erich [1] https://issues.apache.org/jira/browse/ARTEMIS-518 [2] https://github.com/apache/activemq-artemis/pull/512 Dňa 06.05.2016 o 15:59 Justin Bertram napísal(a): > That seems reasonable to me. Open a JIRA and send a PR. > > > Justin > > ----- Original Message ----- > From: "Erich Duda" > To: dev@activemq.apache.org > Cc: "Miroslav Novak" > Sent: Friday, May 6, 2016 8:45:28 AM > Subject: Leaking threads in the Artemis test suite > > Hi guys, > I investigate test failures in the Artemis test suite and I see many > "Thread leaked" issues. From stack traces It is evident that leaking > threads arise from some thread pool and they are waiting for a job. > Problem is that I am not able to find which thread pool owns the > threads. When the default thread factory is used for creation of a > thread, the name and the stack trace of thread looks following. > > Thread Thread[pool-4-thread-45,5,main] is still alive with the following stackTrace: > sun.misc.Unsafe.park(Native Method) > java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) > java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) > java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) > java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > java.lang.Thread.run(Thread.java:745) > > I suggest to do not use the Java default thread factory but we should > create own default thread factory which will set up name of thread's > group in such way that we could find to which thread pool the thread > belongs. > > I have already created such thread factory and reconfigure all thread > pools to use it. You can review my changes in the commit [1]. The > default thread factory is implemented in the ActiveMQThreadFactory class > [2]. The name and the stack trace of the thread created by this thread > factory looks following. > > Thread Thread[Thread-0 > (org.apache.activemq.artemis.tests.unit.core.paging.impl.PagingStoreImplTest-32863545),5,org.apache.activemq.artemis.tests.unit.core.paging.impl.PagingStoreImplTest-32863545] > is still alive with the following stackTrace: > sun.misc.Unsafe.park(Native Method) > java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) > java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) > java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) > java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > java.lang.Thread.run(Thread.java:745) > > I ran full test suite and it seems that this changes did not break > anything. What do you think about it? Would it be possible to merge the > commit? > > Thank you! > > Erich > > [1] > https://github.com/dudaerich/activemq-artemis/commit/b1e48589acd9c1febd62105cc23fa4c04d673a5b > [2] > https://github.com/dudaerich/activemq-artemis/blob/b1e48589acd9c1febd62105cc23fa4c04d673a5b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadFactory.java >