You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mark Diggory <md...@gmail.com> on 2005/11/15 22:23:31 UTC

[httpclient] CLOSE_WAIT sticking around

I'm getting a number of CLOSE_WAIT sockets between HttpClient and my 
Apache server. Do you know how I can configure HttpClient not to leave 
behind CLOSE_WAIT's?

Cheers,
Mark Diggory

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


Re: [httpclient] CLOSE_WAIT sticking around

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2005-11-15 at 17:22 -0500, Mark Diggory wrote:
> Oleg Kalnichevski wrote:
> 
> >On Tue, 2005-11-15 at 16:23 -0500, Mark Diggory wrote:
> >  
> >
> >>I'm getting a number of CLOSE_WAIT sockets between HttpClient and my 
> >>Apache server. Do you know how I can configure HttpClient not to leave 
> >>behind CLOSE_WAIT's?
> >>
> >>    
> >>
> >
> >Mark,
> >
> >Consider implementing an idle connection handler
> >
> >For details see
> >
> >http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpConnectionManager.html#closeIdleConnections(long)
> >http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.html
> >
> >Hope this helps
> >
> >Oleg
> >  
> >
> 
> Ok, That seems logical, I have another consideration that may change 
> your recommendation, I'm using MultithreadedConnectionManager and I'm 
> starting to be less interested reusing connections and just let them go 
> away between requests. It tends to be the case that the requests are 
> neither long lived nor numerous per HttpClient, I can live with the 
> overhead of reconnecting if it means resources stay free between. How do 
> I tune the client to accomplish this?
> 

Just extend the MultithreadedConnectionManager, override the
releaseConnection method and always close the connection you get as a
parameter

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.html#releaseConnection(org.apache.commons.httpclient.HttpConnection)

Hope this helps

Oleg

> thanks,
> Mark


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


Re: [httpclient] CLOSE_WAIT sticking around

Posted by Mark Diggory <md...@gmail.com>.
Oleg Kalnichevski wrote:

>On Tue, 2005-11-15 at 16:23 -0500, Mark Diggory wrote:
>  
>
>>I'm getting a number of CLOSE_WAIT sockets between HttpClient and my 
>>Apache server. Do you know how I can configure HttpClient not to leave 
>>behind CLOSE_WAIT's?
>>
>>    
>>
>
>Mark,
>
>Consider implementing an idle connection handler
>
>For details see
>
>http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpConnectionManager.html#closeIdleConnections(long)
>http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.html
>
>Hope this helps
>
>Oleg
>  
>

Ok, That seems logical, I have another consideration that may change 
your recommendation, I'm using MultithreadedConnectionManager and I'm 
starting to be less interested reusing connections and just let them go 
away between requests. It tends to be the case that the requests are 
neither long lived nor numerous per HttpClient, I can live with the 
overhead of reconnecting if it means resources stay free between. How do 
I tune the client to accomplish this?

thanks,
Mark

Re: [httpclient] CLOSE_WAIT sticking around

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2005-11-15 at 16:23 -0500, Mark Diggory wrote:
> I'm getting a number of CLOSE_WAIT sockets between HttpClient and my 
> Apache server. Do you know how I can configure HttpClient not to leave 
> behind CLOSE_WAIT's?
> 

Mark,

Consider implementing an idle connection handler

For details see

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpConnectionManager.html#closeIdleConnections(long)
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.html

Hope this helps

Oleg

> Cheers,
> Mark Diggory
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


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