IBM Support

Troubleshooting OutOfMemoryError (OOM) that points to com/ibm/rmi/iiop/CDROutputStream Object

Troubleshooting


Problem

This document explains the OOM condition that occurs with the com/ibm/rmi/iiop/CDROutputStream Object appearing as the large object in the stack.

Symptom

An OutOfMemoryError (OOM) can occur during the writing of a very large object (the target object), com/ibm/rmi/iiop/CDROutputStream may be considered the cause due to its large size.

Cause

The cause is in fact the target object and not the com/ibm/rmi/iiop/CDROutputStream which appears to be the cause due to the large size.

579,765,632 (44%) [200] 10 com/ibm/rmi/iiop/CDROutputStream 0x9fd780
460,223,296 (35%) [40] 2 com/ibm/rmi/util/IdentityHashtable 0x1083230
460,223,256 (35%) [26,738,704] 16,386 array of
[Lcom/ibm/rmi/util/IdentityHashtableEntry; 0x2f6a4310
234,335,168 (17%) [32] 4 com/ibm/rmi/util/IdentityHashtableEntry
88,240 (0%) [32] 4 com/ibm/rmi/util/IdentityHashtableEntry
81,976 (0%) [32] 4 com/ibm/rmi/util/IdentityHashtableEntry

Diagnosing The Problem

The com/ibm/rmi/iiop/CDROutputStream IdentityHashtable may have references to some or all of the objects in the graph of the target object. This is a performance feature for value indirection and the number of objects will be based on how much of the target object has been processed and written. This may mean that heap analysis tools will not report those objects in the retained sets of either the CDROutputStream or the target object, but instead in the dominator of those two objects (such as a thread or classloader). To understand the "real size" of the target object in Memory Analyzer Tool:

1. Find the target object by process of elimination or, more deterministically, by taking a system dump and running Java Basics -> Thread Stacks, finding the writeObject method call and taking the object from the frame locals.
2. Create a customized retained set on the target object and exclude (the -x option) the CDROutputStream object.

Similarly, there can be another object graph for CDROutputStream object as below:

<0> [1,576,780,960] 0x7000000358cc8e8 [296] com/ibm/rmi/iiop/CDROutputStream
<1> [571,605,296] 0x7000000358ccb98 [104] com/ibm/rmi/util/buffer/SequentialByteBuffer
<2> [571,605,128] 0x7000000358ccbe8 [64] com/ibm/rmi/util/list/LinkedList
<3> [571,605,064] 0x7000000358cd4b8 [88] com/ibm/rmi/util/buffer/SequentialByteBuffer$Position
<4> [571,604,976] 0x7000000358cd5a8 [88] com/ibm/rmi/util/buffer/SequentialByteBuffer$Position
.........................
<1> [516,120,944] 0x7000000358cd078 [80] com/ibm/rmi/util/IdentityHashtable
<2> [516,120,864] 0x700000061626780 [26,738,712] array of com/ibm/rmi/util/IdentityHashtableEntry
<3> [42,983,200] 0x70000007eef7ca0 [80] com/ibm/rmi/util/IdentityHashtableEntry
<4> [42,982,984] 0x70000007ceac148 [80] com/ibm/rmi/util/IdentityHashtableEntry
.......................
<1> [489,049,784] 0x7000000358cca18 [88] com/ibm/rmi/util/Interop
<2> [489,048,968] 0x700000002d989c0 [720] com/ibm/CORBA/iiop/ORB
<3> [488,954,760] 0x700000002d96e30 [88] java/util/Properties
<4> [488,954,672] 0x700000002d97618 [792] array of java/util/Hashtable$Entry
........................

The large com/ibm/rmi/iiop/CDROutputStream comprises of com/ibm/rmi/util/buffer/SequentialByteBuffer and com/ibm/rmi/util/IdentityHashtable objects

Purpose of SequentialByteBuffer and IdentityHashtable objects:
In case of local invocation, the buffer in use is SequentialByteBuffer. The large sized SequentialByteBuffer is due to large size messages leading to the buffer contents being held up in the memory till the entire message is written out.
Large amount of com/ibm/rmi/util/buffer/SequentialByteBuffer$Position can be a result of large CORBA messages being marshalled/unmarshalled which will be normal. By design, SequentialBytebuffer holds data in "Pieces" of successively double sizes starting with 1KB,2kB,4kb and so on, hence for large-sized messages the latter datapieces are themselves very large in size (LinkedList). This SequentialByeBuffer is eligible for GC once the processing of the request is complete.

IdentityHashtable - valueCache is populated whenever a value is being marshalled and it is held in the memory till the entire message is written out (to support value indirection). Value indirection is used to avoid writing redundant data into the message and hence requires the message to remain in the memory till the entire message is written out. The entries in the IdentityHashtable depends on the size of the message being sent which cannot be controlled/avoided because of the logic used in value indirection.

Resolving The Problem

Workaround for the OOM caused due to large CDROutputStream in colocated scenario:
If OOM happens in a colocated scenario (both client and server using the same orb), the memory footprint caused by usage of SequentialByteBuffer and IdentityHashTable for these large objects can be avoided by applying the following workarounds-
i) Force remote invocation for large sized requests by invoking
rmic with the following option:
rmic -iiop -noLocalStubs <interface_name>
[To use this option at EJB deploy time, refer to:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/urun_rapp_ejbdeploy.html
Set up -rmic "nolocalstubs"]
This will avoid the usage of large-sized SequentialByteBuffer and hence the number of entries in IdentityHashTable is reduced.

ii) Use pass by reference with single class loader policy for better memory usage in their collocated scenario.
To set this up:
-> Set up the classloader policy to SINGLE
-> Set up the pass_by_reference to true.
[To use this option at EJB deploy time, refer to:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/uorb_rsetg.html

When PassbyReference option is used marshalling is not involved thus avoiding the usage of large IdentityHashtableEntry's for local invocations

[{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"ORB","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"1.4.2;1.4.1;1.3.1","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21470344