OpenJPA
  1. OpenJPA
  2. OPENJPA-1630

NPE in MetaDataRepository when preloading is enabled under heavy stress.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2, 2.0.0-beta3, 2.0.0, 2.0.1, 2.1.0
    • Fix Version/s: 2.0.0
    • Component/s: kernel
    • Labels:
      None

      Description

      A timing window exists in the MetaDataRepository where the following[1] NPE can be encountered. It is incorrect to assume that calling processRegisteredClasses at the end of preload would process all registered classes. As it turns out, that call does process all registered classes that this instance of the MDR cares about. The problem comes in when after the MDR is preloaded, Entities that belong to a different PU are registered with the PCRegistry and they are added to the _registered list.

      [1] Caused by: java.lang.NullPointerException
      at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClasses(MetaDataRepository.java:1622)
      at org.apache.openjpa.meta.ClassMetaData.getPCSubclasses(ClassMetaData.java:364)
      at org.apache.openjpa.meta.ClassMetaData.getPCSubclassMetaDatas(ClassMetaData.java:381)
      at org.apache.openjpa.meta.ClassMetaData.getMappedPCSubclassMetaDatas(ClassMetaData.java:403)
      at org.apache.openjpa.jdbc.meta.ClassMapping.getMappedPCSubclassMappings(ClassMapping.java:628)
      at org.apache.openjpa.jdbc.meta.ClassMapping.getIndependentAssignableMappings(ClassMapping.java:667)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:380)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:342)
      at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.initialize(WsJpaJDBCStoreManager.java:147)
      at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
      at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
      at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1005)
      at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:963)
      ... 46 more

        Activity

        Rick Curtis created issue -
        Hide
        Rick Curtis added a comment -

        There are a couple of ways to fix this problem. The easiest is to always lock on the _registered list when mutating, regardless of whether or not _locking is set.

        The not so easy, but probably more correct solution is to only add classes to the _registered list that each MDR cares about. I'm leaning toward the first solution for the 2.0.x branch due to stability concerns and I'll investigate fixing it differently in trunk.

        Show
        Rick Curtis added a comment - There are a couple of ways to fix this problem. The easiest is to always lock on the _registered list when mutating, regardless of whether or not _locking is set. The not so easy, but probably more correct solution is to only add classes to the _registered list that each MDR cares about. I'm leaning toward the first solution for the 2.0.x branch due to stability concerns and I'll investigate fixing it differently in trunk.
        Rick Curtis made changes -
        Field Original Value New Value
        Attachment OPENJPA-1630.patch [ 12441638 ]
        Hide
        Rick Curtis added a comment -

        Committed revision 934103 to trunk.

        Show
        Rick Curtis added a comment - Committed revision 934103 to trunk.
        Rick Curtis made changes -
        Fix Version/s 2.1.0 [ 12314542 ]
        Kevin Sutter made changes -
        Fix Version/s 2.0.0 [ 12314019 ]
        Hide
        Rick Curtis added a comment -

        Committed revision 934478 to 2.0.X.

        Show
        Rick Curtis added a comment - Committed revision 934478 to 2.0.X.
        Rick Curtis made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Donald Woods added a comment -

        Don't need Fix Version of 2.1.0 since 2.0.0 hasn't been released yet....

        Show
        Donald Woods added a comment - Don't need Fix Version of 2.1.0 since 2.0.0 hasn't been released yet....
        Donald Woods made changes -
        Fix Version/s 2.1.0 [ 12314542 ]
        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Rick Curtis
            Reporter:
            Rick Curtis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development