IBM Support

Document uploads using CMIS for FileNet Content Manager may fail with, Error 500: java.lang.OutOfMemoryError: Java heap space

Troubleshooting


Problem

Document uploads using CMIS for FileNet Content Manager may fail with, Error 500: java.lang.OutOfMemoryError: Java heap space.

Symptom

Uploading larger documents ( typically > 10 MB in size) using the CMIS createDocument function which sets properties, content and the version state in a single call may fail with an Error 500: java.lang.OutOfMemoryError: Java heap space. The exact document size when this issue is encountered this issue depends on system configuration and state.

Cause

Use of the CMIS createDocument function results in a heap memory allocation between 3x-5x the size of the document being uploaded in the JVM where CMIS for FileNet Content Manager is hosted. For large documents, the allocation requests is considerable. The heap is consumed rapidly if a large number of requests of smaller documents are submitted at the same time.

Diagnosing The Problem

Heap dumps captured on the JVM where CMIS for FileNet Content Manager is hosted indicate large allocations in java.lang.String.toCharArray() or com.ibm.xml.xlxp2.scan.util.ArrayAllocator.resizeCharArray() that are associated with a com.ibm.ecm.cmis.app.datasource.ContentSource.createNewOrMove call.

Resolving The Problem

When uploading documents that exceed 1-2% of the JVM heap, instead of using the CMIS createDocument function :


Document newDoc = parent.createDocument(properties, contentStream, VersioningState.MAJOR);

Create the document without setting the content :

Document newDoc = parent.createDocument(props, null, VersioningState.CHECKEDOUT)

Build a content stream and set it on the document, then check in the document :

ContentStream cs = session.getObjectFactory().createContentStream(name, file.size(),mimetype,new FileInputStream(file));
newDoc.setContentStream(contentStream, true, true);
newDoc.checkIn(true, null, null, "")

This sequence results in the content being streamed to the CMIS interface and using considerably less heap allocation and allows for the upload a larger documents that may otherwise fail when using the single createDocument call.

[{"Product":{"code":"SSEUEX","label":"IBM Content Navigator"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"CMIS for FileNet Content Manager","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF014","label":"iOS"},{"code":"PF003","label":"Android"},{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"2.0.3;2.0.2","Edition":"","Line of Business":{"code":"LOB18","label":"Miscellaneous LOB"}}]

Document Information

Modified date:
17 June 2018

UID

swg21902205