From dev-return-4909-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Tue Jul 17 02:27:40 2007 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 5490 invoked from network); 17 Jul 2007 02:27:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jul 2007 02:27:40 -0000 Received: (qmail 34016 invoked by uid 500); 17 Jul 2007 02:01:02 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 33987 invoked by uid 500); 17 Jul 2007 02:01:02 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 33977 invoked by uid 99); 17 Jul 2007 02:01:02 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jul 2007 19:01:02 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of kevan.miller@gmail.com designates 64.233.184.238 as permitted sender) Received: from [64.233.184.238] (HELO wr-out-0506.google.com) (64.233.184.238) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jul 2007 19:00:58 -0700 Received: by wr-out-0506.google.com with SMTP id l58so759466wrl for ; Mon, 16 Jul 2007 19:00:37 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; b=EEOyr3Pt8Gpe6fjoCAiRMibxCwQbw7b6Eo6Wtqg/N5Tp/VmDrgdQIP9WLnGqjY2vh4FHHvrXes9CYEPzKGOIuCkIA3UCo+2j7FitqX+80UKmA0RwML6lMziLpADXAy2JTciyziIyJgm/9kOaAnVWThMHf2VRE/+Bf/fBamk+Od4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; b=C9DsrAPiS1oQRDqL7QqlIJbosMZsIV/cACK9PMzOqU8voNk0cnCjxKnB0Y88gKAsOZkUr2EuaPdRnSJ5Hup2+n7w7hiStwmnXQVZzZpElptoT1YH9SZ1CEh5OnYWtXfWTyC+bX8OCnSVk/32rFtu7DGx5ovAJZ8cPGDPSAU1XBs= Received: by 10.90.105.19 with SMTP id d19mr3940312agc.1184637637736; Mon, 16 Jul 2007 19:00:37 -0700 (PDT) Received: from ?192.168.1.100? ( [69.134.127.1]) by mx.google.com with ESMTP id 34sm32462761agc.2007.07.16.19.00.35 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jul 2007 19:00:35 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <28EA7232-B502-4C3E-880F-9398805D6A34@apache.org> References: <28EA7232-B502-4C3E-880F-9398805D6A34@apache.org> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Kevan Miller Subject: Re: PCRegistry ClassLoader memory leak Date: Mon, 16 Jul 2007 22:00:35 -0400 To: dev@openjpa.apache.org X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org On Jul 16, 2007, at 5:40 PM, Marc Prud'hommeaux wrote: > Kevan- > > How many deploy/undeploys does it take before it runs out of memory? Hi Marc, It's application dependent. I think it took about 20 deploy/undeploy cycles. We're losing a ClassLoader per deploy/undeploy. Looks like for this app each ClassLoader is ~ 1 meg. I was running with an 80meg max permgen: export JAVA_OPTS="-XX:MaxPermSize=80m -verbose:gc -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError" FYI, here are the GC Roots for one of our ClassLoaders being leaked -- http://people.apache.org/~kevan/PCRegistryLeak.html > > I recall a long time back we had a similar problem (although the > error was entrenched in the same functionality contained in the > javax.jdo.spi.JDOImplHelper. I don't know if a solution was ever > found. Short of figuring out some way to listen for the death of a > ClassLoader and manually unregistering metadata when that happens, > I can't think of any way to deal with this automatically. > > Anyone have any ideas? Well, with some increased complexity, you could have WeakReference values (have ConcurrentReferenceHashMap permit WeakReference keys and WeakReference values (or wrap Meta with a WeakReference before inserting into the _metas table). Define an OpenJPA specific interface for triggering ClassLoader events. Either a callback interface or straight method call. The JSF specification defined a javax.faces.FactoryFinder.releaseFactories() method which can be called during an undeploy. That's spec-defined however. I'd prefer not to go that way, but it's not impossible... --kevan