IBM Support

IT27638: An MQ JMS application deadlocks after IT23101 when multiple threads compare JMS destinations

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 deadlocks when two (or more)
    threads compare JMS Destination objects in different orders.
    
    As an example, consider two threads having access to the same
    two instances of the class com.ibm.mq.jms.MQQueue identified by
    the variables mqQueue1 and mqQueue2.  If the first thread
    invokes the equals(Object) method on mqQueue1 passing in
    mqQueue2 as the argument:
    
      mqQueue1.equals(mqQueue2)
    
    while the second thread simultaneously does the opposite:
    
      mqQueue2.equals(mqQueue1)
    
    then a deadlock can occur.  A Javacore of the JVM shows two
    threads having synchronized on a Map belonging to one of the
    MQQueue objects and blocked while attempting to access the Map
    belonging to the other MQQueue object.  For example:
    
    
    Name: thread-1
    State: BLOCKED on java.util.Collections$SynchronizedMap@71e32214
    owned by: thread-2
    
    Stack trace:
    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
       - locked java.util.Collections$SynchronizedMap@132ff44e
    com.ibm.msg.client.jms.admin.JmsDestinationImpl.equals
    ...
    
    
    
    Name: thread-2
    State: BLOCKED on java.util.Collections$SynchronizedMap@132ff44e
    owned by: thread-1
    
    Stack trace:
    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
       - locked java.util.Collections$SynchronizedMap@71e32214
    com.ibm.msg.client.jms.admin.JmsDestinationImpl.equals
    ...
    

Local fix

Problem summary

  • ****************************************************************
    USERS AFFECTED:
    This issue affects MQ classes for JMS applications.
    
    
    Platforms affected:
    MultiPlatform
    
    ****************************************************************
    PROBLEM DESCRIPTION:
    APAR IT23101 modified the IBM MQ classes for JMS and JCA
    resource adapter to add some additional locking to the Map of
    properties associated with JMS Destinations and Connection
    Factories in order to protect against  modification of the Map
    while a thread was iterating over its entries.  As a result of
    this change, it was possible for a deadlock to occur in the case
    where multiple threads compared either two JMS Destinations or
    two JMS Connection Factory objects by calling the equals(Object)
    method on different instances, passing the other as the method
    argument.
    
    This was because one thread would synchronize on the properties
    Map to iterate over its entries and then attempt to fetch and
    compare the values from the other object's properties Map (which
    was locked by a second thread performing a likewise operation).
    

Problem conclusion

  • The IBM MQ classes for JMS and JCA resource adapter code has
    been updated to take a snapshot of the keys from the properties
    Map associated with JMS Destination or JMS Connection Factory
    objects on which the equals(Object) method was called.  The keys
    are then subsequently used to fetch the property values from the
    property Maps of both objects being compared where only the
    individual lookups of property values is synchronized.
    
    ---------------------------------------------------------------
    The fix is targeted for delivery in the following PTFs:
    
    Version    Maintenance Level
    v9.0 LTS   9.0.0.6
    v9.1 CD    9.1.2
    v9.1 LTS   9.1.0.2
    
    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

    IT27638

  • Reported component name

    IBM MQ BASE M/P

  • Reported component ID

    5724H7261

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-12-31

  • Closed date

    2019-01-23

  • Last modified date

    2019-01-23

  • 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

    IBM MQ BASE M/P

  • Fixed component ID

    5724H7261

Applicable component levels

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSYHRD","label":"IBM MQ"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
23 January 2019