tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: OutOfMemory on large file download with AJP and cachingAllowed=false
Date Fri, 26 Apr 2019 07:56:16 GMT
On 25/04/2019 21:37, Mark Thomas wrote:
> On 25/04/2019 21:16, Christopher Schultz wrote:
>> On 4/25/19 15:55, Mark Thomas wrote:


>> If the resources are caching-aware, then I think the DefaultServlet
>> can just always use Resource.getInputStream.
>> Hmm. That might cause a lot of unnecessary IO if the bytes are
>> actually available.
> That is a very tempting solution. The result is a LOT cleaner than the
> patch I just wrote. CachingResource is smart enough to cache the bytes
> and wrap them in a ByteArrayInputStream if Resource.getInputStream is
> called. My only concern is I think this introduces and additional copy
> of the data. I need to check that.

There was an extra copy but Chris's suggestion got me thinking and I
found a much better solution.

The patch has been applied to 9.0.x and 8.5.x and will be in the next
release of both. 7.0.x is not affected.

The patch fixes the OutOfMemoryError and the ArrayIndexOutOfBoundsException.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message