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





--- Comment #40 from Filip Hanik <[EMAIL PROTECTED]>  2008-04-10 14:56:29 PST 
---
I think I might have found the problem,

I've been unable to reproduce the error using the NIO/APR (APR below) connector
with setting
    <Connector port="8080" 
               protocol="org.apache.coyote.http11.Http11NioProtocol" 
               connectionTimeout="20000" 
               redirectPort="8443" 
               maxHttpHeaderSize="16384" 
               maxKeepAliveRequests="100"/>


I reproduce the error everytime using the regular connector
    <Connector port="8081" 
               protocol="org.apache.coyote.http11.Http11Protocol" 
               connectionTimeout="20000" 
               redirectPort="8443" 
               maxHttpHeaderSize="16384" 
               maxKeepAliveRequests="100"/>

and I am unable to reproduce it using the APR connector
    <Connector port="8082" 
               protocol="org.apache.coyote.http11.Http11AprProtocol" 
               connectionTimeout="20000" 
               redirectPort="8443" 
               maxHttpHeaderSize="16384" 
               maxKeepAliveRequests="100"/>

so I started debugging it, 
The problem is in org.apache.tomcat.util.CharChunk
in two subsequent reads, where the inputbuffer is 16384, it tries to use the
CharChunk to store all the data. The reason it works with the APR/NIO connector
is cause those connectors never pull out more than 8192 bytes from the socket
buffer. 

however, the regular BIO connector will read as much as it can, and then the
B2CConverter tries to append the character array to the CharChunk,
but the CharChunk refuses to grow beyond the limit.

The fix is simple
Index: java/org/apache/tomcat/util/buf/CharChunk.java
===================================================================
--- java/org/apache/tomcat/util/buf/CharChunk.java      (revision 646950)
+++ java/org/apache/tomcat/util/buf/CharChunk.java      (working copy)
@@ -454,7 +454,8 @@
        // Can't grow above the limit
        if( limit > 0 &&
            desiredSize > limit) {
-           desiredSize=limit;
+           limit = desiredSize;
+           //desiredSize=limit;
        }

        if( buff==null ) {

however, we could probably shrink the CharChunk back on a recycle, but it wont
grow beyond maxHttpHeaderSize, so I am not sure we need to


-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to