Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2538

Classloader memory leak in PCRegistry

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Invalid
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Component/s: Enhance, osgi
    • Labels:
      None

      Description

      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 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...

        Attachments

          Activity

            People

            • Assignee:
              curtisr7 Richard G. Curtis
              Reporter:
              ggrzybek Grzegorz Grzybek
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: