IBM Support

IT40776: NullPointerException observed when a security exit is being called concurrently on multiple threads.

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

  • After upgrading from MQ 9.2.0.4 to MQ 9.2.0.5, when an MQ
    classes for Java/JMS client side security exit is called by two
    different threads concurrently, for example in the scenario:
    
      - when an application requests that a new connection be
    established to the queue manager, where the exit rejects the
    connection attempt causing it to be closed, which results in the
    security exit being called again
    
      - when the queue manager sends a response back to the client
    to close the current conversation, which results in the security
    exit being called
    
    a race condition takes place in the processing of the MQCD
    object which is passed to the security exit.
    This results in a NullPointerException being generated by the MQ
    classes for Java/JMS, of the form:
    
    java.lang.NullPointerException
     at com.ibm.mq.exits.MQCD.readFromBuffer(MQCD.java:4009)
     at
    com.ibm.mq.jmqi.remote.exit.NativeExitDefinition.unpackMQCD(Nati
    veExitDefinition.java:341)
     at
    com.ibm.mq.jmqi.remote.exit.NativeExitDefinition.invoke(NativeEx
    itDefinition.java:419)
     at
    com.ibm.mq.jmqi.remote.exit.RemoteExitChain.termExit(RemoteExitC
    hain.java:1463)
     at
    com.ibm.mq.jmqi.remote.exit.RemoteExitChain.termExits(RemoteExit
    Chain.java:1432)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteConnection.disconnect(RemoteCo
    nnection.java:1112)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteConnection.removeSession(Remot
    eConnection.java:882)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteSession.disconnect(RemoteSessi
    on.java:1744)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSes
    sion(RemoteConnectionSpecification.java:365)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(Remo
    teConnectionPool.java:161)
     at
    com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:
    1748)
     at
    com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:
    1274)
     at
    com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJ
    mqiImpl.java:377)
     at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:562)
     at
    com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnecti
    on.java:357)
     at
    com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7Pr
    oviderConnection(WMQConnectionFactory.java:8470)
     at
    com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProv
    iderConnection(WMQConnectionFactory.java:7909)
     at
    com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createCon
    nection(JmsConnectionFactoryImpl.java:325)
     at
    com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConn
    ection(JmsConnectionFactoryImpl.java:243)
     at
    com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConn
    ectionFactory.java:6038)
     at
    com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQ
    QueueConnectionFactory.java:111)
     at
    com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueue
    ConnectionFactory.java:202)
    at myApplication.myMethod()
    

Local fix

Problem summary

  • ****************************************************************
    USERS AFFECTED:
    This issue affects users of the MQ classes for Java and MQ
    classes for JMS, which are configured to utilise client side
    security exits.
    
    
    Platforms affected:
    MultiPlatform
    
    ****************************************************************
    PROBLEM DESCRIPTION:
    There are scenarios where a security exit can end up being run
    on two different threads concurrently for the same connection to
    the queue manager.
    One such scenario was introduced by APAR IT38158:
    
    https://www.ibm.com/support/pages/apar/IT38158
    
    which addressed a connection handle leak when a security exit
    rejected a new connection attempt to the queue manager.  The
    queue manager may request that the newly initiated connection be
    closed before the application thread has closed it, following
    the rejection by the security exit.
    
    This resulted in a race condition associated with the access to
    the MQCD object which is passed to the security exit.  If a
    certain timing condition was reached, this may have resulted in
    the a NullPointerException being generated by the MQ classes for
    Java, for example of the form:
    
    java.lang.NullPointerException
     at com.ibm.mq.exits.MQCD.readFromBuffer(MQCD.java:4009)
     at
    com.ibm.mq.jmqi.remote.exit.NativeExitDefinition.unpackMQCD(Nati
    veExitDefinition.java:341)
     at
    com.ibm.mq.jmqi.remote.exit.NativeExitDefinition.invoke(NativeEx
    itDefinition.java:419)
     at
    com.ibm.mq.jmqi.remote.exit.RemoteExitChain.termExit(RemoteExitC
    hain.java:1463)
     at
    com.ibm.mq.jmqi.remote.exit.RemoteExitChain.termExits(RemoteExit
    Chain.java:1432)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteConnection.disconnect(RemoteCo
    nnection.java:1112)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteConnection.removeSession(Remot
    eConnection.java:882)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteSession.disconnect(RemoteSessi
    on.java:1744)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSes
    sion(RemoteConnectionSpecification.java:365)
     at
    com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(Remo
    teConnectionPool.java:161)
     at
    com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:
    1748)
     at
    com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:
    1274)
     at
    com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJ
    mqiImpl.java:377)
     at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:562)
     at
    com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnecti
    on.java:357)
     at
    com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7Pr
    oviderConnection(WMQConnectionFactory.java:8470)
     at
    com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProv
    iderConnection(WMQConnectionFactory.java:7909)
     at
    com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createCon
    nection(JmsConnectionFactoryImpl.java:325)
     at
    com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConn
    ection(JmsConnectionFactoryImpl.java:243)
     at
    com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConn
    ectionFactory.java:6038)
     at
    com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQ
    QueueConnectionFactory.java:111)
     at
    com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueue
    ConnectionFactory.java:202)
     at myApplication.myMethod()
    
     In this example the NullPointerException was thrown back to the
    application, and the connection attempt failed.
    
     NOTE: This APAR does not affect MQ 9.1
    

Problem conclusion

  • The MQ classes for Java/JMS have been updated such that the
    access to the MQCD object passed to the security exit on the two
    threads is now thread safe.
    
    ---------------------------------------------------------------
    The fix is targeted for delivery in the following PTFs:
    
    Version    Maintenance Level
    
    v9.2 LTS   9.2.0.6
    v9.3 LTS   9.3.0.1
    v9.x CD    9.3.1
    
    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

    IT40776

  • Reported component name

    MQ WINDOWS V7

  • Reported component ID

    5724H7220

  • Reported release

    710

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2022-04-28

  • Closed date

    2022-06-14

  • Last modified date

    2022-10-17

  • 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 WINDOWS V7

  • Fixed component ID

    5724H7220

Applicable component levels

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

Document Information

Modified date:
17 October 2022