[ 
https://issues.apache.org/jira/browse/OPENJPA-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14182568#comment-14182568
 ] 

Grzegorz Grzybek commented on OPENJPA-2538:
-------------------------------------------

Thanks for reminding me to check ;) But yes - I use OpenJPA via Aries-JPA and 
here's the stacktrace during update of the bundle:
{noformat}
        at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.close(EntityManagerFactoryImpl.java:271)
        at 
org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.close(CountingEntityManagerFactory.java:61)
        at 
org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.destroyEntityManagerFactories(EntityManagerFactoryManager.java:429)
        at 
org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(EntityManagerFactoryManager.java:230)
        at 
org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(PersistenceBundleManager.java:296)
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
        at 
org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)
        at 
org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)
        at 
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4650)
        at org.apache.felix.framework.Felix.updateBundle(Felix.java:2598)
        at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:973)
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.update(DirectoryWatcher.java:1126)
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.update(DirectoryWatcher.java:898)
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:482)
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)
{noformat}
Aries detects the change of a bundle and destroys all EMFs associated with it.

> Classloader memory leak in PCRegistry
> -------------------------------------
>
>                 Key: OPENJPA-2538
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2538
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance, osgi
>    Affects Versions: 2.3.0
>            Reporter: Grzegorz Grzybek
>            Priority: Critical
>
> I'm using OpenJPA in OSGi environment (namely: JBoss Fuse 6.1). We had nasty 
> {{NullPointerException}} in Felix when trying to load source code during 
> initialization of class metadata. [This 
> line|https://github.com/apache/openjpa/blob/2.3.0/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java#L1614]
>  returned duplicate entity classes - half of them were from old revision of a 
> bundle and half - from new revision.
> I tracked down the problem to the point, where 
> {{org.apache.openjpa.enhance.PCRegistry#register()}} was invoked as part of 
> constructing new instances of entity classes (static initialization injected 
> during class enhancement). Although {{_metas}} is instance of 
> {{ConcurrentReferenceHashMap}} with weak keys, the keys (entity classes) had 
> other hard references too. Here's a list of the hard refs I got from simple 
> heap dump:
> * org.apache.openjpa.meta.MetaDataRepository#_impls
> * org.apache.openjpa.meta.InheritanceComparator#_base
> * org.apache.openjpa.enhance.PCRegistry.Meta#pcSuper
> * org.apache.openjpa.meta.MetaDataRepository#_oids
> so on every bundle refresh we have next bunch of classes in {{_metas}}...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to