Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 96254 invoked from network); 1 Aug 2007 22:04:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Aug 2007 22:04:21 -0000 Received: (qmail 48629 invoked by uid 500); 1 Aug 2007 22:04:21 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 48597 invoked by uid 500); 1 Aug 2007 22:04:21 -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 48587 invoked by uid 99); 1 Aug 2007 22:04:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Aug 2007 15:04:20 -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; Wed, 01 Aug 2007 22:04:09 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7CA9871403E for ; Wed, 1 Aug 2007 15:03:53 -0700 (PDT) Message-ID: <29666589.1186005833217.JavaMail.jira@brutus> Date: Wed, 1 Aug 2007 15:03:53 -0700 (PDT) From: "Kevin Sutter (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Resolved: (OPENJPA-285) Multiple deploy/undeploy leaks memory in PCRegistry In-Reply-To: <16954032.1184653864960.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/OPENJPA-285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Sutter resolved OPENJPA-285. ---------------------------------- Resolution: Fixed Fix Version/s: 1.0.0 Resolved per the discussion on the dev mailing list (http://www.nabble.com/PCRegistry-ClassLoader-memory-leak-tf4091308.html) and this Issue. > Multiple deploy/undeploy leaks memory in PCRegistry > --------------------------------------------------- > > Key: OPENJPA-285 > URL: https://issues.apache.org/jira/browse/OPENJPA-285 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 1.0.0 > Environment: Geronimo 2.0 > Reporter: Pinaki Poddar > Assignee: Kevin Sutter > Fix For: 1.0.0 > > Attachments: ImplHelperClassLoaderMemoryLeak.patch, JIRA-285.patch.2.txt, JIRA-285.patch.txt, PCRegistryClassLoaderMemoryLeak.patch > > > Kevin Miller reported: > Geronimo is running out of PermGen space in some simple deploy/ undeploy scenarios involving OpenJPA. The cause of the problem seems to be the _metas table in PCRegistry. _metas is a ConcurrentReferenceHashMap with WEAK reference keys and HARD reference values. The keys are the PersistenceCapable classes. While the values are the metadata for these classes which are maintained by the internal Meta class. > The cause of the ClassLoader memory leak is simple -- if any of the objects/classes held by the Meta class (e.g. fieldTypes) have also been loaded by the same ClassLoader used to load the PersistenceCapable class, the PersistenceCapable class (the weak key) will never be GCed. The value of the HashMap entry will always maintain a hard reference to the ClassLoader. Since the ClassLoader will never be GC'ed, the the the pcClass Class object will never be GC'able... > The problem can be easily recreated using current Geronimo trunk and the Geronimo Daytrader application. > Patrick Linskey suggested: > Change PCRegistry.fieldTypes to be String[] instead of Class[], and dematerialize them as needed. > Robert Burrell Donkin/Marc Prud'hommeaux both pointed out that alternatives such as to > listen for the death of a ClassLoader and manually unregistering metadata would be more costly in terms of complexity. > This patch follows Patrick's suggestion. > 1. Changes the Meta.fieldTypes to String[] from Class[] > 2. Adapts the enhanced bytecode accordingly to the modified method signatures > 3. PCRegistry getFieldTypes() load the fields' declared type using the same loader that loaded the owner pc class. > Note: For a class C and its field f, CL(c) == CL(f) is not always true. (Kevin Miller) > But CL(c) will be able to load declared type of f either directly or via one of its parent (Craig Russel) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.