Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9DC869058 for ; Tue, 14 Feb 2012 19:28:24 +0000 (UTC) Received: (qmail 15603 invoked by uid 500); 14 Feb 2012 19:28:24 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 15505 invoked by uid 500); 14 Feb 2012 19:28:24 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 15497 invoked by uid 99); 14 Feb 2012 19:28:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2012 19:28:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2012 19:28:21 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id ADFB01B75EB for ; Tue, 14 Feb 2012 19:28:00 +0000 (UTC) Date: Tue, 14 Feb 2012 19:28:00 +0000 (UTC) From: "Mark Thomas (Resolved) (JIRA)" To: issues@commons.apache.org Message-ID: <534464421.37518.1329247680714.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (POOL-161) ContextClassLoader problems for the Evictor thread MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/POOL-161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mark Thomas resolved POOL-161. ------------------------------ Resolution: Fixed Fix ported to 1.5.x and 2.x > ContextClassLoader problems for the Evictor thread > -------------------------------------------------- > > Key: POOL-161 > URL: https://issues.apache.org/jira/browse/POOL-161 > Project: Commons Pool > Issue Type: Bug > Affects Versions: 1.5.4 > Reporter: Sylvain Laurent > Fix For: 1.6.1, 2.0, 1.5.8 > > Attachments: TestGenericObjectPoolClassLoader.patch.txt, patch_Evictor_CCL.txt > > > Since a single Timer is used for several GenericObjectPool instances, this may create classloader issues and a memory leak of one classloader : > Let's imagine the following scenario : > - commons-pool.jar is in the classpath of a webapp container (e.g. tomcat). > - 2 webapps A and B are deployed, each creating an instance of GenericObjectPool for its own usage. > - each webapp makes use of the idle object evictor and sets a positive number for minIdle > - first, webapp A instantiates its GenericObjectPool. Since this is the first TimerTask to be created, the Timer instance is created, thus creating a Thread whose ContextClassLoader is the current one, that is webapp A's ContextClassLoader. > The TimerTask properly creates instances of idle objects in the pool, making use of the ObjectFactory provided by A. > - then B instantiates its GenericObjectPool. A new TimerTask is created, and it tries to invoke the ObjectFactory provided by B. But when it needs a class that only exists in B webapp, it cannot find it because the ContextClassLoader of the Timer Thread is A's classloader. > Other side effect : if webapp A is undeployed, but B is still running, then A's webappClassLoader cannot be GCed because the Timer Thread keeps a strong reference to A's classloader (as its context classloader). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira