IBM Support

PM38422: POTENTIAL DEADLOCK IN OPENJPA WITH OBJECT RELATIONAL MAPPING (ORM) PROCESSING

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The potential for deadlock exists with the ORM XML processing
    function.
    
    In an environment with multiple threads (such as an application
    server), operations (such as creating a new
    EntityManagerFactory or transformation Classloader activity) can
    lead to a point where a Xerces SAX Parser (acquired by
    XMLFactory) is constituted and run.
    
    Xerces calls Thread.currentThread().getContextClassloader()
    during its execution to construct the SAXParser (via
    ObjectFactory.createObject()). This means that within the call
    to Xerces, a ClassLoader lock will be attempted on the Thread's
    ContextClassLoader.
    
    If there is already a lock with a ClassLoader higher in the
    heirarchy, and another thread with a lock on the same
    ContextClassLoader that is waiting to acquire a lock on a
    higher level ClassLoader, then a deadlock will occur.
    

Local fix

  • N/A
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server Feature Pack for EJB 3.0             *
    ****************************************************************
    * PROBLEM DESCRIPTION: Potential for deadlock with the ORM     *
    *                      XML processing function.                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    There exists the potential for deadlock with the ORM XML
    processing function. In an environment with multiple threads
    (such as an application server), operations (such as creating
    a new EntityManagerFactory or transformation Classloader
    activity) can lead to a point where a Xerces SAX Parser
    (acquired by XMLFactory) is constituted and run. Xerces
    calls Thread.currentThread().getContextClassloader() during
    its execution to construct the SAXParser (via
    ObjectFactory.createObject()). This means that within the call
    to Xerces,a ClassLoader lock will be attempted on the Thread's
    ContextClassLoader. If there is already a lock with a
    ClassLoader higher in the heirarchy, and another thread with a
    lock on the same ContextClassLoader that is waiting to acquire
    a lock on a higher level ClassLoader, then a deadlock will
    occur.
    The deadlock occurs when a thread locks the compound
    classloader (which can occur when the transformation
    classloader is invoked) and xerces is called upon by the
    OpenJPA PCEnhancer to parse an ORM XML. Xerces will use the
    ClassLoader specified by the Thread's ContextClassLoader to
    find SAX/DOM Parser implementations, which means its
    ClassLoader activity will attempt to lock the Thread's
    ContextClassLoader.  In this situation, the ContextClassLoader
    is the classloader at the bottom of the heirarchy, such as the
    web container's application classloader.  The deadlock can
    occur if another thread performs a ClassLoader operation that
    locks the web container application classloader and makes a
    further attempt to lock a higher classloder (ie, the compound
    classloader).  This results in a deadlock between the two
    threads.
    

Problem conclusion

  • The solution is to change the Thread ContextClassLoader to the
    classloader used to load the OpenJPA implementation classes
    which guerentees that Xerces will use a ClassLoader that is
    higher up the ClassLoader heirarchy.
    
    An interim Fix is available to fix this problem.  In addition
    to installing the interim Fix, the following property must be
    set to enable the ContextClassLoader override in either the
    persistence unit definition within persistence.xml or as a
    server JVM property:
    
    =========================================
    Name:   openjpa.Compatibility
    Value:  OverrideContextClassloader=true
    =========================================
    
    The fix for this APAR is currently targeted for inclusion in
    fix pack 6.1.0.43.  Please refer to the Recommended Updates
    page for delivery information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM38422

  • Reported component name

    WAS EJB3 FEATUR

  • Reported component ID

    5724J0851

  • Reported release

    610

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-05-04

  • Closed date

    2011-05-12

  • Last modified date

    2012-01-05

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    PM38854 PM65860

Fix information

  • Fixed component name

    WAS EJB3 FEATUR

  • Fixed component ID

    5724J0851

Applicable component levels

  • R610 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"6.1","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
27 October 2021