Uploaded image for project: 'Remote Alfresco API rivet'
  1. Remote Alfresco API rivet
  2. CMA-44

RestExecuterImpl.createFilePostMethod causes the buffering of the entire file InputStream to determine the size of the stream, hence causing an OutOfMemory: heap space exception

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.1.2, 1.1.3, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0
    • Fix Version/s: None
    • Component/s: CMA Impl
    • Labels:
      None
    • MoSCoW:
      Must do

      Description

      RestExecuterImpl.createFilePostMethod is creating an instance of InputStreamRequestEntity using http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/methods/InputStreamRequestEntity.html#InputStreamRequestEntity(java.io.InputStream) constructor, which implies that it will buffer the entire InputStream to determine the size of the InputStream. For large enough files, this is causing:

      com.rivetlogic.core.cma.exception.CmaRuntimeException: java.lang.OutOfMemoryError: Java heap space
        at com.rivetlogic.core.cma.impl.ContentServiceImpl.writeContentFromStream(ContentServiceImpl.java:124)
        at com.rivetlogic.hbsp.dewey.listeners.UploadListenerAction.processUpload(UploadListenerAction.java:153)
      ...

       
      There is a way to overcome this issue by providing the file size to the content service and channeling it to the RestExecuterImpl.createFilePostMethod method, and using this InputStreamRequestEntity constructor instead: http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/methods/InputStreamRequestEntity.html#InputStreamRequestEntity(java.io.InputStream,%20long)

      This issue affects all versions of CMA/RAAr and will probably require a new writeContentFromStream method to be added to CMA/RAAr.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                djkim Dong-Jun Kim [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Zendesk Support