hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: connections left in CLOSE_WAIT state
Date Wed, 19 Feb 2014 11:17:43 GMT
On Wed, 2014-02-19 at 10:33 +0000, Nir Dweck wrote:
> Hi,
> I am using httpclient version 4.2.3.
> I did a split proxy, which receives an HTTP requests, opens its body in order to log
its content and then sends the content in two requests, one for the local host server and
the other to a different server running a newer version of our software.
> this is the code I used to create the http client:
>                         PoolingClientConnectionManager mngr = new PoolingClientConnectionManager();
>                         mngr.setMaxTotal(400);
>                         mngr.setDefaultMaxPerRoute(200);
>                         m_http = new DefaultHttpClient(mngr);
>                         m_http.getParams().setParameter(CoreProtocolPNames.USER_AGENT,
"phytech proxy");
>                         m_http.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
10000);
>                         m_http.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
5000);
> 
> When I need to send a request to the remote host, I take a thread from a thread pool
which will perform the operation asynchronously.
> The proxy and the old server are running windows and the new server is on a Linux machine.
> The problem is I get tones of connections with the remote server which are stuck in CLOSE_WAIT
state and never get released (none with the local host - I think it is related to the fact
the local machine is windows).
> When I look at the sniffer I don't see any FIN message coming out of my client, although
I set SO_TIMEOUT to 5 seconds and there were more than 5 seconds of inactivity.
> Any idea what am I doing wrong and how to solve it?
> Thanks,
> Nir

Most likely you need to pro-actively evict stale / idle connections from
the connection pool

http://hc.apache.org/httpcomponents-client-4.2.x/tutorial/html/connmgmt.html#d5e652

Oleg 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message