IBM Support

IT22398: IBM MQ classes for Java/JMS v9.0 "java.lang.OutOfMemoryError" exception thrown when trace is enabled

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

  • A WebSphere MQ classes for JMS v7.0 application is upgraded to
    use IBM MQ classes for JMS v9.0, and is running the application
    with IBM MQ classes for JMS trace enabled.
    
    The application fails with a "java.lang.OutOfMemoryError" due to
    the JVM's heap space being exhausted, which did not happen when
    using the WebSphere MQ classes for JMS v7.0, despite having the
    same JVM heap size configured.
    
    An FDC is produced of the form:
    
    |  Reason     :-  Data trace threw exception
    |  exception  :-  ExceptionDepth is 2
    |  exception  :-
    |  Cause:1       :-  java.lang.OutOfMemoryError:
                                  Java heap space
    |  Message:1     :-  Java heap space
    |  StackTrace:1  :-  java.lang.OutOfMemoryError:
                                 Java heap space
    |  at  java.lang.StringBuilder.ensureCapacityImpl
                 (StringBuilder.java:366)
    |  at java.lang.StringBuilder.append
                 (StringBuilder.java:232)
    |  at com.ibm.msg.client.commonservices.j2se.trace.
                HumanFormatter.format(HumanFormatter.java:279)
    
    The exception is not thrown if the IBM MQ classes for JMS trace
    is not enabled.
    

Local fix

  • To prevent the problem from happening, the following JVM
    argument can be provided when the JVM is started:
    
    -Dcom.ibm.msg.client.commonservices.trace.maxBytes=4096
    
    
    Alternatively, the JVM's maximum heap size can be increased to a
    larger value, which can be achieved using the JVM argument:
    
      -Xmx<size>
    
    where <value> is the maximum heap size to use.  For example, if
    the application was running with the 256MB heap size, the
    following command would quadrouple it to 1.0GB:
    
      -Xmx1024M
    

Problem summary

  • ****************************************************************
    USERS AFFECTED:
    This issue affects the users of:
    
    - IBM MQ classes for Java v9.0
    - IBM MQ classes for JMS v9.0
    
    who run their application while IBM MQ classes for Java/JMS
    trace is enabled.
    
    
    Platforms affected:
    MultiPlatform
    
    ****************************************************************
    PROBLEM DESCRIPTION:
    When a IBM MQ Classes for Java/JMS application was run with
    trace enabled, a "java.lang.OutOfMemoryError" exception occurred
    and an FDC  file was generated, with the content:
    
    |   Reason     :-  Data trace threw exception
    |   exception  :-  ExceptionDepth is 2
    |   exception  :-
    |   Cause:1       :-  java.lang.OutOfMemoryError: Java
    |   Message:1     :-  Java
    |   StackTrace:1  :-  java.lang.OutOfMemoryError: Java
    |   at
    java.lang.StringBuilder.ensureCapacityImpl(StringBuilder.java:36
    6)
    |   at java.lang.StringBuilder.append(StringBuilder.java:232)
    |   at
    com.ibm.msg.client.commonservices.j2se.trace.HumanFormatter.form
    at(HumanFormatter.java:279)
    |   at
    java.util.logging.StreamHandler.publish(StreamHandler.java:222)
    |   at
    java.util.logging.FileHandler.publish(FileHandler.java:693)
    |   at java.util.logging.Logger.log(Logger.java:749)
    |   at java.util.logging.Logger.doLog(Logger.java:776)
    |   at java.util.logging.Logger.logp(Logger.java:996)
    |   at
    com.ibm.msg.client.commonservices.j2se.trace.DefaultTracer.trace
    Data(DefaultTracer.java:353)
    |   at
    com.ibm.msg.client.commonservices.trace.Trace.traceDataInternal(
    Trace.java:1266)
    |   at
    com.ibm.msg.client.commonservices.trace.Trace.data(Trace.java:11
    71)
    |   at
    com.ibm.mq.jmqi.internal.JmqiTools.traceApiBufferFromStaticMetho
    d(JmqiTools.java:455)
    |   at
    com.ibm.mq.jmqi.internal.JmqiTools.getMessage(JmqiTools.java:163
    1)
    |   at
    com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiGet(RemoteFAP.java:7024
    )
    |   at
    com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiGet(InterceptedJmqiI
    mpl.java:1329)
    |   at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiGet(ESEJMQI.java:603)
    |   at
    com.ibm.mq.MQDestination.internalGetMessage(MQDestination.java:1
    041)
    |   at com.ibm.mq.MQDestination.getInt(MQDestination.java:582)
    |   at com.ibm.mq.MQDestination.get(MQDestination.java:448)
    
    
    The "java.lang.OutOfMemoryError" was thrown because the
    application has consumed a number of large messages, and trace
    was attempting to print their entire payload ByteBuffer content
    into the trace file.  The JVM was not able to allocate the
    required amount of memory which the tracing component was
    requesting, resulting in the exception being thrown.
    

Problem conclusion

  • IBM MQ classes for Java/JMS have been updated so that by
    default, only the first 4096 bytes of the message payload is
    written out to the trace file, which significantly reduces the
    addition memory overhead requirements of tracing large messages.
    
    This default value can be altered through the use of the JVM
    property:
    
      com.ibm.msg.client.commonservices.trace.maxBytes
    
    
    For example, to write out up to 8KB of the message payload, the
    following JVM argument could be used when the JVM is started:
    
    -Dcom.ibm.msg.client.commonservices.trace.maxBytes=8192
    
    ---------------------------------------------------------------
    The fix is targeted for delivery in the following PTFs:
    
    Version    Maintenance Level
    v9.0 CD    9.0.5
    v9.0 LTS   9.0.0.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

    IT22398

  • 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

    2017-09-14

  • Closed date

    2018-02-20

  • Last modified date

    2018-02-20

  • 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:
20 February 2018