XAManagedConnectionFactory.isEqual(Object) deadlock in JBoss EAP

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7
    • 6

Issue

  • Deadlock found in thread dump for threads executing org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.isEqual(Object)

  • Two or more threads hold one lock on an instance of java.util.Collections$SynchronizedMap and attempt to obtain a lock on a different instance (e.g. locks on 0xaaaaaaa and 0xbbbbbbb in the example below).

        "thread-one" ...
        java.lang.Thread.State: BLOCKED (on object monitor)
            at java.util.Collections$SynchronizedMap.get(Collections.java:2584)
            - waiting to lock <0xaaaaaaa> (a java.util.Collections$SynchronizedMap)
            at java.util.AbstractMap.equals(AbstractMap.java:495)
            at java.util.Collections$SynchronizedMap.equals(Collections.java:2631)
            - locked <0xbbbbbbb> (a java.util.Collections$SynchronizedMap)
            at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.isEqual(XAManagedConnectionFactory.java:563)
            - locked <0xbbbbbbb> (a java.util.Collections$SynchronizedMap)
            at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.equals(XAManagedConnectionFactory.java:598)
            at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory$SubjectActions.doCheck(BaseWrapperManagedConnectionFactory.java:1397)
            at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory$SubjectActions.addMatchingProperties(BaseWrapperManagedConnectionFactory.java:1508)
            at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.getConnectionProperties(BaseWrapperManagedConnectionFactory.java:1135)
            at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.matchManagedConnections(XAManagedConnectionFactory.java:533)
            ...
            at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
            at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)
            ...
    
        "thread-two" ...
        java.lang.Thread.State: BLOCKED (on object monitor)
            at java.util.Collections$SynchronizedMap.size(Collections.java:2572)
            - waiting to lock <0xbbbbbbb> (a java.util.Collections$SynchronizedMap)
            at java.util.AbstractMap.equals(AbstractMap.java:482)
            at java.util.Collections$SynchronizedMap.equals(Collections.java:2631)
            - locked <0xaaaaaaa> (a java.util.Collections$SynchronizedMap)
            at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.isEqual(XAManagedConnectionFactory.java:563)
            - locked <0xaaaaaaa> (a java.util.Collections$SynchronizedMap)
            at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.equals(XAManagedConnectionFactory.java:598)
            ... [same stack as thread-one above] ...
            at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
            at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)
            ...
    

Resolution

This issue1 is resolved in This content is not included.EAP 7.1 cumulative patch (CP) 3 and later releases. Production systems should use the latest available cumulative patch.

This issue2 is resolved in This content is not included.EAP 6.4 cumulative patch (CP) 21 and later releases. Production systems should use the latest available cumulative patch.

Root Cause

This is a known defect:

Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.