tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuri de Wit" <yde...@gmail.com>
Subject is there a hard coded size limit to mod_jk response headers?
Date Sun, 14 Jan 2007 13:38:53 GMT
I am getting a buffer overflow while using my webapp deployed to
Apache2, mod_jk1.2 and Tomcat5.5.17.

I am basically trying to send an HTTP response back to the browser
with a custom json header (X-JSON header) containing more than 8Kb
since this is the default way to send json state back to the browser
using Prototype.js.

My basic question is this: is there a hard-coded limit of 8Kb for HTTP
response headers?

If the answer is yes I could see this being a serious problem in a
world of AJAX where we not only want to send a XHTML snipped back to
the browser in the entity body, but also piggyback additional state in
the response.

I browsed the source code for Tomcat5.5.17 and found out that AJP13
sends 8Kb packets back to apachelib-mod_jk. For the response entity
body any number of 8Kb packets are sent, but for the response entity
header it seems that always only one 8Kb packet is sent.

I also found a post to this mailing list that although asked a similar
question, did end up providing a definite answer aside from how to
better log the problem
(http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg73387.html).


And this is the exception I am seeing:
--------------------------------------------------------------------------------------
Jan 4, 2007 9:08:11 PM org.apache.jk.common.MsgAjp cpBytes
SEVERE: Buffer overflow: buffer.len=8192 pos=25 data=215738
Jan 4, 2007 9:08:11 PM org.apache.jk.common.MsgAjp cpBytes
SEVERE: Overflow
java.lang.Throwable
        at org.apache.jk.common.MsgAjp.cpBytes(MsgAjp.java:172)
        at org.apache.jk.common.MsgAjp.appendByteChunk(MsgAjp.java:146)
        at org.apache.jk.common.MsgAjp.appendBytes(MsgAjp.java:132)
        at org.apache.jk.common.JkInputStream.appendHead(JkInputStream.java:302)
        at org.apache.jk.core.MsgContext.action(MsgContext.java:258)
        at org.apache.coyote.Response.action(Response.java:182)
        at org.apache.coyote.Response.sendHeaders(Response.java:378)
        at org.apache.jk.common.JkInputStream.doWrite(JkInputStream.java:126)
        at org.apache.coyote.Response.doWrite(Response.java:559)
        at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:361)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
        at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:314)
        at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:278)
        at org.apache.catalina.connector.Response.finishResponse(Response.java:476)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)
--------------------------------------------------------------------------------------

thanks,

-- yuri

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


Mime
View raw message