tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: svn commit: r375582 - in /tomcat/connectors/trunk: http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java jk/java/org/apache/coyote/ajp/AjpAprProcessor.java
Date Thu, 09 Feb 2006 13:02:28 GMT
Looking at the implementation in network.c, we can only leave
the loop upon a write error, in which case we return the
APR error (negative) or we've sent more (or the
exact same) as we've decided to send, which must
be positive. So it doesn't look like it, no. In
any case, the inf loop would be in the impl from
what I can see :)

On Feb 7, 2006, at 9:24 AM, Tim Funk wrote:

> Is it possible for Socket.sendbb to return 0? If so, on what  
> conditions? (Trying to prevent an infinite loop)
>
> [This happened to me with a jk bug in the past (tomcat 4.0 and an  
> older version of jk) during a read where tomcat was assuming one  
> thing and apache was assuming something else. (Can't remember the  
> specifics) ]
>
> -Tim
>
> remm@apache.org wrote:
>> Author: remm
>> Date: Tue Feb  7 03:47:20 2006
>> New Revision: 375582
>> URL: http://svn.apache.org/viewcvs?rev=375582&view=rev
>> Log:
>> - 38464: Fix incorrect usage of sendbb method, which can in some  
>> cases do incomplete writes.
>>   Let me know if there are still problems.
>> - Note: for AJP, the fix is there just-in-case, as it is  
>> apparently impossible to get in this
>>   situation.
>> Modified: tomcat/connectors/trunk/http11/src/java/org/apache/ 
>> coyote/http11/InternalAprOutputBuffer.java
>> URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/ 
>> src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java? 
>> rev=375582&r1=375581&r2=375582&view=diff
>> ===================================================================== 
>> =========
>> --- tomcat/connectors/trunk/http11/src/java/org/apache/coyote/ 
>> http11/InternalAprOutputBuffer.java (original)
>> +++ tomcat/connectors/trunk/http11/src/java/org/apache/coyote/ 
>> http11/InternalAprOutputBuffer.java Tue Feb  7 03:47:20 2006
>> @@ -695,9 +695,14 @@
>>      protected void flushBuffer()
>>          throws IOException {
>>          if (bbuf.position() > 0) {
>> -            if (Socket.sendbb(socket, 0, bbuf.position()) < 0) {
>> -                throw new IOException(sm.getString 
>> ("iib.failedwrite"));
>> -            }
>> +            int i = 0;
>> +            int n = 0;
>> +            do {
>> +                if ((n = Socket.sendbb(socket, i, bbuf.position 
>> ())) < 0) {
>> +                    throw new IOException();
>> +                }
>> +                i += n;
>> +            } while (i < bbuf.position());
>>              bbuf.clear();
>>          }
>>      }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>


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


Mime
View raw message