On 17/01/2013 11:07, Steve Mactaggart wrote: > Hi All, > > I have been hunting a BufferOverflowException on our production system for > the last while, and initially thought this was resolved by issue 53119, we > have subsequently upgraded to 7.0.32 and have still seen the issues. > > Reading through the mailing list archive it seems I am not the only one > having issues with the NIO AJP Processor. > > http://www.mailinglistarchive.com/html/users@tomcat.apache.org/2012-10/msg00477.html > > Below is what we are seeing pretty regularly in our production environment. > This is probably load based, as we don't seem to see this in any of our > development environments. > > Caused by: java.nio.BufferOverflowException > at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:183) > at > org.apache.coyote.ajp.AjpNioProcessor.output(AjpNioProcessor.java:281) > at > org.apache.coyote.ajp.AbstractAjpProcessor$SocketOutputBuffer.doWrite(AbstractAjpProcessor.java:1122) > at org.apache.coyote.Response.doWrite(Response.java:504) > at > org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:383) > at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:342) > at > org.apache.tomcat.util.buf.IntermediateOutputStream.write(C2BConverter.java:278) > at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) > at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282) > at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) > at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) > at > org.apache.tomcat.util.buf.WriteConvertor.write(C2BConverter.java:242) > at java.io.BufferedWriter.write(BufferedWriter.java:188) > at > org.apache.tomcat.util.buf.C2BConverter.convert(C2BConverter.java:125) > at > org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:476) > at > org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:152) > at > org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:119) > at > org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:336) > at > org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:353) > at ... 72 more > > As mentioned in the mailing list, could this be an issue that just needs to > be re-applied to the nio version of the Processor from the original issue I > thought this was?
Unlikely. I have taken a look at the AjpNioProcessor code and I don't see any exception paths that could lead to the writeBuffer not being cleared. > I don't really know why this is happening, so can't provide a test case but > do know this is happening pretty regularly. How regularly? How many requests an hour and how many errors like the above an hour? (I'm trying to figure out what additional logging could be added that provides useful information without filling your disks with logs). The two possibilities at this point are: a) Tomcat bug b) Application bug b would be caused by something (e.g. servlet, filter) retaining a reference to a request and using it after the request had finished processing. If you set the following system property: org.apache.catalina.connector.RECYCLE_FACADES to true (e.g. in setenv.[bat|sh]) and your application is retaining references you should start to see NPEs and the stack trace should point to where the problem is. If you still see BufferOverflowException with that setting in place then that would make a Tomcat bug more likely. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org