[
https://issues.apache.org/jira/browse/HTTPCLIENT-1660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oleg Golovanov updated HTTPCLIENT-1660:
---------------------------------------
Description:
I am not sure, is this bug related to http client or linux system or something
else.
I have http client with pooling connection manager.
Requests done to http service using different proxies.
Configuration:
{quote}
PoolingHttpClientConnectionManager cm = new
PoolingHttpClientConnectionManager(registry);
cm.setMaxTotal(3000);
cm.setDefaultMaxPerRoute(3000);
cm.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(20000).build());
{/quote}
RequestConfig.custom()
.setConnectionRequestTimeout(0)
.setSocketTimeout(20000)
.setConnectTimeout(3000)
.setRedirectsEnabled(true)
.setMaxRedirects(10)
.setStaleConnectionCheckEnabled(false)
.build();
HttpClients.custom()
.setConnectionManager(connectionManager)
.setRetryHandler(new DefaultHttpRequestRetryHandler())
.setDefaultRequestConfig(requestConfig)
.setDefaultHeaders(headers)
.setUserAgent(userAgent)
.setRedirectStrategy(new LaxRedirectStrategy())
.setSSLSocketFactory(sslCsf)
.setHostnameVerifier(new AllowAllHostnameVerifier())
.build();
Problem:
after fetching all bytes from response input stream and closing it, thread can
stuck for an hour or even more.
Log:
2015-06-19 14:31:32,645 pool-5-thread-357 TRACE lib.Toolkit Closing
stream
2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
org.apache.http.impl.conn.DefaultManagedHttpClientConnection
http-outgoing-680033: Shutdown connection
2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
org.apache.http.impl.execchain.MainClientExec Connection discarded
2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
org.apache.http.impl.conn.DefaultManagedHttpClientConnection
http-outgoing-680033: Close connection
2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
org.apache.http.impl.conn.PoolingHttpClientConnectionManager Connection
released: [id: 680033][route: {}->http://46.28.69.176:40751->http://yan
dex.ru:80][total kept alive: 0; route allocated: 0 of 3000; total allocated: 0
of 3000]
2015-06-19 15:34:20,103 pool-5-thread-357 DEBUG
lib.job.search_engine.SearchEngineJob Error, class="SocketTimeoutException",
message="Read timed out"
So, its took more than an hour just to close connection, even though socket
timeout set to 20 seconds.
How to solve this problem?
Thanks.
was:
I am not sure, is this bug related to http client or linux system or something
else.
I have http client with pooling connection manager.
Requests done to http service using different proxies.
Configuration:
PoolingHttpClientConnectionManager cm = new
PoolingHttpClientConnectionManager(registry);
cm.setMaxTotal(3000);
cm.setDefaultMaxPerRoute(3000);
cm.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(20000).build());
RequestConfig.custom()
.setConnectionRequestTimeout(0)
.setSocketTimeout(20000)
.setConnectTimeout(3000)
.setRedirectsEnabled(true)
.setMaxRedirects(10)
.setStaleConnectionCheckEnabled(false)
.build();
HttpClients.custom()
.setConnectionManager(connectionManager)
.setRetryHandler(new DefaultHttpRequestRetryHandler())
.setDefaultRequestConfig(requestConfig)
.setDefaultHeaders(headers)
.setUserAgent(userAgent)
.setRedirectStrategy(new LaxRedirectStrategy())
.setSSLSocketFactory(sslCsf)
.setHostnameVerifier(new AllowAllHostnameVerifier())
.build();
Problem:
after fetching all bytes from response input stream and closing it, thread can
stuck for an hour or even more.
Log:
2015-06-19 14:31:32,645 pool-5-thread-357 TRACE lib.Toolkit Closing
stream
2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
org.apache.http.impl.conn.DefaultManagedHttpClientConnection
http-outgoing-680033: Shutdown connection
2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
org.apache.http.impl.execchain.MainClientExec Connection discarded
2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
org.apache.http.impl.conn.DefaultManagedHttpClientConnection
http-outgoing-680033: Close connection
2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
org.apache.http.impl.conn.PoolingHttpClientConnectionManager Connection
released: [id: 680033][route: {}->http://46.28.69.176:40751->http://yan
dex.ru:80][total kept alive: 0; route allocated: 0 of 3000; total allocated: 0
of 3000]
2015-06-19 15:34:20,103 pool-5-thread-357 DEBUG
lib.job.search_engine.SearchEngineJob Error, class="SocketTimeoutException",
message="Read timed out"
So, its took more than an hour just to close connection, even though socket
timeout set to 20 seconds.
How to solve this problem?
Thanks.
> Http client 4.3.6 - loooong timeout on socket close
> ---------------------------------------------------
>
> Key: HTTPCLIENT-1660
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1660
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 4.3.6
> Environment: ogolovanov@ostrovok:~$ uname -a
> Linux ostrovok 3.2.0-74-generic #109-Ubuntu SMP Tue Dec 9 16:45:49 UTC 2014
> x86_64 x86_64 x86_64 GNU/Linux
> ogolovanov@ostrovok:~$ lsb_release -a
> No LSB modules are available.
> Distributor ID: Ubuntu
> Description: Ubuntu 12.04.5 LTS
> Release: 12.04
> Codename: precise
> Reporter: Oleg Golovanov
>
> I am not sure, is this bug related to http client or linux system or
> something else.
> I have http client with pooling connection manager.
> Requests done to http service using different proxies.
> Configuration:
> {quote}
> PoolingHttpClientConnectionManager cm = new
> PoolingHttpClientConnectionManager(registry);
> cm.setMaxTotal(3000);
> cm.setDefaultMaxPerRoute(3000);
>
> cm.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(20000).build());
> {/quote}
> RequestConfig.custom()
> .setConnectionRequestTimeout(0)
> .setSocketTimeout(20000)
> .setConnectTimeout(3000)
> .setRedirectsEnabled(true)
> .setMaxRedirects(10)
> .setStaleConnectionCheckEnabled(false)
> .build();
> HttpClients.custom()
> .setConnectionManager(connectionManager)
> .setRetryHandler(new DefaultHttpRequestRetryHandler())
> .setDefaultRequestConfig(requestConfig)
> .setDefaultHeaders(headers)
> .setUserAgent(userAgent)
> .setRedirectStrategy(new LaxRedirectStrategy())
> .setSSLSocketFactory(sslCsf)
> .setHostnameVerifier(new AllowAllHostnameVerifier())
> .build();
> Problem:
> after fetching all bytes from response input stream and closing it, thread
> can stuck for an hour or even more.
> Log:
> 2015-06-19 14:31:32,645 pool-5-thread-357 TRACE lib.Toolkit
> Closing stream
> 2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
> org.apache.http.impl.conn.DefaultManagedHttpClientConnection
> http-outgoing-680033: Shutdown connection
> 2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
> org.apache.http.impl.execchain.MainClientExec Connection discarded
> 2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
> org.apache.http.impl.conn.DefaultManagedHttpClientConnection
> http-outgoing-680033: Close connection
> 2015-06-19 15:34:20,102 pool-5-thread-357 DEBUG
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager Connection
> released: [id: 680033][route: {}->http://46.28.69.176:40751->http://yan
> dex.ru:80][total kept alive: 0; route allocated: 0 of 3000; total allocated:
> 0 of 3000]
> 2015-06-19 15:34:20,103 pool-5-thread-357 DEBUG
> lib.job.search_engine.SearchEngineJob Error,
> class="SocketTimeoutException", message="Read timed out"
> So, its took more than an hour just to close connection, even though socket
> timeout set to 20 seconds.
> How to solve this problem?
> Thanks.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]