tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <>
Subject Re: svn commit: r359753 - /tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/
Date Sat, 31 Dec 2005 21:15:29 GMT

"Remy Maucherat" <> wrote in message
> Bill Barker wrote:
>> Without actually checking, mod_jk/mod_proxy_ajp should only send an 
>> unrequested initial bodyChunk if the client sends a CL.  So if there is 
>> no CL, Tomcat will send back GET_BODY_CHUNK message, and act on the 
>> response from Httpd/IIS/SunOne.
>> The main purpose of the "read required" field is to clean up if the 
>> Servlet fails to actually read the (small) Request body, even though 
>> Httpd sent it to Tomcat.  Now (like the APR/AJP Connector), Tomcat 
>> doesn't attempt to actually read (by default) the unrequested initial 
>> bodyChunk until the Servlet asks for it.  However, if Httpd sent it, and 
>> the Servlet didn't ask for it, Tomcat needs to get it out of the the 
>> Socket stream, or bad things are going to happen ;-).
> I have no idea if I need to make a similar change in APR AJP. This stuff 
> is a bit black magic to me.

It looks like the APR/AJP connector will have similar problems (but I 
haven't tried it :).  The 'try to read body when none sent' case (BZ 38047) 
is easy to test.  You should just see the Request hang forever.  The 
'servlet doesn't read the body' case should look like it's just really slow, 
since mod_jk/mod_proxy_ajp will recover from it, but you should see lots of 
stuff in the logs.

What this is about is that (for the sake of shaving a couple of ms :) tha 
AJP/1.3 protocol is inconsistant when the CL > 0.  In this case, 
mod_jk/mod_proxy_ajp will send two packets initially:  The normal 
Request-Header packet, followed by the first Body-Chunk packet.  This is 
where the special handling is required.  It used to be the case that the 
JK/Java Connector would look for the CL > 0, and read the Body-Chunk packet 
right away.  This worked fine in keeping the special-case handling 
restricted to one small place.  However, when I was benchmarking it, it 
seemed that Tomcat would get to the read a lot of times before Httpd got to 
the write (so Tomcat would block needlessly).  That's when I changed it to 
be more like the APR/AJP Connector.

Because the APR/AJP Connector isn't so over-designed, you could probably do 
a cleaner solution than my (e.g. checking CL directly, instead of setting a 

> Rémy 

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

View raw message