IBM Support

IT43854: A MQ classes for JMS application reaches a deadlock condition when comparing MQDestination objects

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • An MQ classes for JMS application reaches a deadlock condition
    when two (or more) threads are simultaneously comparing MQ
    classes for JMS Destination objects.
    This was observed within a Spring application prior to the
    application attempting to put a message to a queue.
    
    The JVM reported the following deadlock messages and thread
    stacks for the two threads:
    
    Thread ID[120] Deadlocked on
    Lock[java.util.Collections$SynchronizedMap@1fcfd9fb] held by
    Thread ID[121]:
    
    java.base@11.0.18.0.1/java.util.Collections$SynchronizedMap.get(
    Collections.java:2594)
    
    com.ibm.msg.client.jms.internal.JmsPropertyContextImpl.getObject
    Property(JmsPropertyContextImpl.java:582)
    
    com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl.g
    etStringProperty(JmsReadablePropertyContextImpl.java:358)
    
    com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl.c
    ompareContexts(JmsReadablePropertyContextImpl.java:924)
    
    com.ibm.msg.client.jms.admin.JmsDestinationImpl.equals(JmsDestin
    ationImpl.java:854)
    
    org.springframework.jms.connection.CachingConnectionFactory$Dest
    inationCacheKey.destinationEquals(CachingConnectionFactory.java:
    548)
     ... ... ...
    
    
    Thread ID[121] Deadlocked on
    Lock[java.util.Collections$SynchronizedMap@782351bc] held by
    Thread ID[120]:
    
    java.base@11.0.18.0.1/java.util.Collections$SynchronizedMap.get(
    Collections.java:2594)
    
    com.ibm.msg.client.jms.internal.JmsPropertyContextImpl.getObject
    Property(JmsPropertyContextImpl.java:582)
    
    com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl.g
    etStringProperty(JmsReadablePropertyContextImpl.java:358)
    
    com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl.c
    ompareContexts(JmsReadablePropertyContextImpl.java:924)
    
    com.ibm.msg.client.jms.admin.JmsDestinationImpl.equals(JmsDestin
    ationImpl.java:854)
    
    org.springframework.jms.connection.CachingConnectionFactory$Dest
    inationCacheKey.destinationEquals(CachingConnectionFactory.java:
    548)
     ... ... ...
    

Local fix

Problem summary

  • ****************************************************************
    USERS AFFECTED:
    Users of the MQ classes for JMS.
    
    
    Platforms affected:
    MultiPlatform
    
    ****************************************************************
    PROBLEM DESCRIPTION:
    An application utilising the MQ classes for JMS can compare two
    JMS Destination object instances, for example by calling the
    method:
    
    com.ibm.mq.jms.MQDestination.equals(
    com.ibm.mq.jms.MQDestination );
    
    APAR IT27638 reported a problem where this comparison could
    result in a deadlock condition if multiple threads were doing
    this comparison concurrently.  The code change associated with
    this deadlock (put into the MQ 9.0 and 9.1 LTS releases)
    resolved the problem by taking a snapshot of each object before
    comparing the objects.
    
    An alternative solution was used for the development release at
    the time (MQ 9.1 CD) which offered higher performance.  However
    this solution was then found to still reach the deadlock
    condition if the comparison was being performed by multiple
    threads in the same millisecond.
    
    To re-cap on the previous APAR, the conditions for this deadlock
    were:
    
    Two MQDestination object instances:
    
      com.ibm.mq.jms.MQDestination destination1
      com.ibm.mq.jms.MQDestination destination2
    
    Thread 1:
      destination1.equals(destination2)
    
    Thread 2:
      destination2.equals(destination1)
    
    which could result in two threads deadlocked against each other
    with the thread stacks:
    
    java.util.Collections$SynchronizedMap.get
    com.ibm.msg.client.jms.internal.JmsPropertyContextImpl.getObject
    Property
    com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl.g
    etStringProperty
    com.ibm.msg.client.jms.internal.JmsReadablePropertyContextImpl.c
    ompareContexts
    com.ibm.msg.client.jms.admin.JmsDestinationImpl.equals
    

Problem conclusion

  • The code solution associated with this APAR has updated the
    algorithm used internally to compare the two objects to ensure
    that the locks associated with each Destination object are taken
    in the same order, which prevents the possibility of the
    deadlock occurring.
    
    ---------------------------------------------------------------
    The fix is targeted for delivery in the following PTFs:
    
    Version    Maintenance Level
    v9.2 LTS   9.2.0.20
    v9.3 LTS   9.3.0.10
    v9.x CD    9.3.4
    
    The latest available maintenance can be obtained from
    'WebSphere MQ Recommended Fixes'
    http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg27006037
    
    If the maintenance level is not yet available information on
    its planned availability can be found in 'WebSphere MQ
    Planned Maintenance Release Dates'
    http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg27006309
    ---------------------------------------------------------------
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT43854

  • Reported component name

    MQ APPL M2002 V

  • Reported component ID

    5737H4701

  • Reported release

    924

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2023-06-01

  • Closed date

    2023-07-19

  • Last modified date

    2023-07-19

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

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

Fix information

  • Fixed component name

    MQ APPL M2002 V

  • Fixed component ID

    5737H4701

Applicable component levels

[{"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Product":{"code":"SS5K6E","label":"IBM MQ Appliance"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"924","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
20 July 2023