hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Berlin <sber...@limepeer.com>
Subject Re: CLOSE_WAIT, logging
Date Mon, 08 Dec 2003 03:44:30 GMT
The reason this is happening is because the releaseConnection method of  
HttpMethods does not close the connection, it just returns it to the  
HttpConnectionManager for reuse by another HttpMethod.  A 'Connection:  
Close' header tells HttpClient that this connection should be closed  
after the request is made (instead of leaving it open, for further  
HTTP/1.1 transfers).

Because the public API of HttpMethod has no 'close' method, and one  
would generally expect that, there is a misconception about what  
releaseConnection does.  A suggestion that has been posted here before  
is adding an 'abort' method to HttpMethod and HttpMethodBase, the  
contents of which call close() on the underlying HttpConnection.

Thanks,
  Sam

On Sunday, December 7, 2003, at 10:31  PM, Jesus M. Salvo Jr. wrote:

>
> From a snoop capture, Apache Coyote sent a TCP FIN 20 seconds after  
> the last ACK from the client.
> But the client did not sent a TCP FIN of its own, leaving the socket  
> in CLOSE_WAIT.
>
> The only difference between the Coyote's HTTP response and Orion's  
> HTTP response is that the Orion response have "Connection: close" in  
> the HTTP header.
>
> So, what I did, by using HttpClient, I added:
>
>    postMethod.addRequestHeader( "Connection", "close");
>
>
> After the above, I no longer have CLOSE_WAIT sockets.
>
> Regards,
>
> John
>
>
>
> Jesus M. Salvo Jr. wrote:
>
>>
>> HttpClient RC 2.0
>> 64-bit Solaris 8
>> JDK 1.3.1_09
>>
>>
>> I am seeing lots of sockets in CLOSE_WAIT, despite the fact that  
>> "postMethod.releaseConnection();" is called.
>> This has happened so far against 2 of our ( different ) clients'  
>> webservers, mostly to Tomcat / Coyote.
>> The problem with CLOSE_WAIT sockets do not seem to be happening  
>> against Orion.
>> What happens in the long run is that I run of file descriptors
>>
>> I am now able to reproduce the same problem against the client's test  
>> webservers ...
>> but in turnin on logging, the logging is not being logged on stdout.
>>
>> In order to give meaningful results to this list about my CLOSE_WAIT  
>> problem,
>> I wrote a small class and script to replicate the problem, but still  
>> no logging.
>> Here is the sample shell script run on cygwin:
>>
>> CLASSPATH=classes
>> CLASSPATH=$CLASSPATH\;/cvs/softgame-latest/development/lib/commons- 
>> httpclient.jar
>> CLASSPATH=$CLASSPATH\;/cvs/softgame-latest/development/lib/commons- 
>> logging.jar
>> REM  
>> CLASSPATH=$CLASSPATH\;/cvs/softgame-latest/development/lib/log4j.jar
>>
>> java \
>>     
>> - 
>> Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Simple 
>> Log \
>>    -Dorg.apache.commons.logging.simplelog.showdatetime=true \
>>    -Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug \
>>     
>> - 
>> Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclien 
>> t=debug \
>>    $JAVA_DEFINES -classpath $CLASSPATH HttpClientTest
>>
>>
>> Help !
>>
>> Regards,
>>
>> John
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:  
>> commons-httpclient-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:  
>> commons-httpclient-dev-help@jakarta.apache.org
>>
>>
>>
>>
>
>
> -- 
> Jesus M. Salvo Jr.
> Mobile Internet Group Pty Ltd
> (formerly Softgame International Pty Ltd)
> M: +61 409 126699
> T: +61 2 94604777
> F: +61 2 94603677
>
> PGP Public key:  
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC0BA5348
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:  
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:  
> commons-httpclient-dev-help@jakarta.apache.org
>
>


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


Mime
View raw message