tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuri de Wit" <>
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

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
        at org.apache.jk.common.MsgAjp.cpBytes(
        at org.apache.jk.common.MsgAjp.appendByteChunk(
        at org.apache.jk.common.MsgAjp.appendBytes(
        at org.apache.jk.common.JkInputStream.appendHead(
        at org.apache.jk.core.MsgContext.action(
        at org.apache.coyote.Response.action(
        at org.apache.coyote.Response.sendHeaders(
        at org.apache.jk.common.JkInputStream.doWrite(
        at org.apache.coyote.Response.doWrite(
        at org.apache.catalina.connector.OutputBuffer.realWriteBytes(
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(
        at org.apache.catalina.connector.OutputBuffer.doFlush(
        at org.apache.catalina.connector.OutputBuffer.close(
        at org.apache.catalina.connector.Response.finishResponse(
        at org.apache.catalina.connector.CoyoteAdapter.service(
        at org.apache.jk.server.JkCoyoteHandler.invoke(
        at org.apache.jk.common.HandlerRequest.invoke(
        at org.apache.jk.common.ChannelSocket.invoke(
        at org.apache.jk.common.ChannelSocket.processConnection(
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(
        at org.apache.tomcat.util.threads.ThreadPool$


-- yuri

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

View raw message