[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 Created: 12/Jun/09 Updated: 15/Oct/10 |
|
| Status: | Open |
| Project: | Remote Alfresco API rivet |
| Component/s: | CMA Impl |
| 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 |
| Type: | Improvement | Priority: | Critical |
| Reporter: | Dong-Jun Kim [X] (Inactive) | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| 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. |