[jira] [Commented] (OFBIZ-10133) streaming large content cause out of memory exception.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-10133) streaming large content cause out of memory exception.

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-10133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16324678#comment-16324678 ]

Jacques Le Roux commented on OFBIZ-10133:
-----------------------------------------

Thanks Wai,

Your slightly modified patch is in
trunk r1821036  
R17.12 r1821037
R16.11 r1821038 (conflicts handled by hand)

I just removed final for bufferSize, I see no needs for that local variable and it can even be interesting to change its value externally at some point.

I did not close yet because, I already wondered about that, and after commiting and fixing a conflicts handled by hand in R16.11 and I remembered this question I forgot to ask: why you did not use length at all (previously used to set the size of buffer). And if you have a good reason, then why did you not refactor the method and remove the variable length which is now useless.

It seems to me that it should still be used, I see no reason to read empty data in the buffer...

> streaming large content cause out of memory exception.
> ------------------------------------------------------
>
>                 Key: OFBIZ-10133
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10133
>             Project: OFBiz
>          Issue Type: Bug
>          Components: content
>    Affects Versions: Trunk
>            Reporter: Wai
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-10133.patch, OFBIZ-10133.patch, OFBIZ-10133.patch, OFBIZ-10133.patch, OFBIZ-10133.patch, OFBIZ-10133.patch, OFBIZ-10133.patch, OFBIZ-10133.patch
>
>
> When ofbiz streams a large content (eg. video file), get out of memory exception.
> console output...
> 2018-01-01 05:01:03,933 |jsse-nio-8443-exec-2 |MycoReqMapHandlerBase         |E| Java heap space
> java.lang.OutOfMemoryError: Java heap space
>         at org.apache.commons.io.output.ByteArrayOutputStream.needNewBuffer(ByteArrayOutputStream.java:127) ~[commons-io-2.5.jar:2.5]
>         at org.apache.commons.io.output.ByteArrayOutputStream.write(ByteArrayOutputStream.java:158) ~[commons-io-2.5.jar:2.5]
>         at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2147) ~[commons-io-2.5.jar:2.5]
>         at org.apache.commons.io.IOUtils.copy(IOUtils.java:2102) ~[commons-io-2.5.jar:2.5]
>         at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2123) ~[commons-io-2.5.jar:2.5]
>         at org.apache.commons.io.IOUtils.copy(IOUtils.java:2078) ~[commons-io-2.5.jar:2.5]
>         at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:721) ~[commons-io-2.5.jar:2.5]
>  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)