https://issues.apache.org/bugzilla/show_bug.cgi?id=51124

--- Comment #1 from Ramiro <ram...@conductiva.com> 2011-05-04 09:39:28 UTC ---
Created attachment 26956
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=26956
patch for BodyContentImpl class of trunk

We are reproducing this problem after getting an OutOfMemoryError on
BodyContentImpl.reAllocBuff.

java.lang.OutOfMemoryError: Java heap space
        at
org.apache.jasper.runtime.BodyContentImpl.reAllocBuff(BodyContentImpl.java:595)
        at
org.apache.jasper.runtime.BodyContentImpl.write(BodyContentImpl.java:109)
        at java.io.PrintWriter.write(PrintWriter.java:382)


We are on version 6.0.29, but the cause is still in trunk.

When the buffer needs to increase the size and an OOM error is thrown the
bufferSize member variable is increased before the buffer is reallocated. But
the BodyContentImpl is accessible for later requests (from the PageContext
pool) with a bufferSize greater than the real buffer size, causing the
ArrayIndexOutOfBoundsException to be thrown when trying to use the buffer space
above the real size.

To solve the problem the bufferSize member variable should be updated only
after the buffer array is properly created.

The patch fixes this issue.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to