hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HTTPCLIENT-1476) Thread lock within httpClient call
Date Fri, 07 Mar 2014 09:27:48 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1476?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Kalnichevski resolved HTTPCLIENT-1476.
-------------------------------------------

    Resolution: Invalid

Please post your questions to the httpclient user list [1].

As far as this problem is concerned I think your application very likely leaks connections
(by failing to always close response objects), depletes the connection pool and causes all
subsequent requests to blocking waiting for a free connection.

Oleg

[1] http://hc.apache.org/mail.html

> Thread lock within httpClient call
> ----------------------------------
>
>                 Key: HTTPCLIENT-1476
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1476
>             Project: HttpComponents HttpClient
>          Issue Type: Test
>          Components: HttpClient
>    Affects Versions: 4.3 Final
>         Environment: Linux, Virtual machine
>            Reporter: Gazolinia
>              Labels: newbie
>             Fix For: 4.3 Final
>
>
> We have a multi threaded application which makes call to many http server. To make this
http connection we are using HttpClient code with Pooling connectionManager. Recently we identified
that all the threads in our application got stuck within the HttpClient code execution (Will
paste/upload the thread dump soon.) as a result our application stopped running. Please let
us know if this is not the right forum for this question.
> 1) Our code snippet is as follows.
>        HttpClient httpClient;
>        
>        Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
>                 .register(HTTP_PROTOCOL, PlainConnectionSocketFactory.getSocketFactory())
>                 .register(HTTPS_PROTOCOL, SSLConnectionSocketFactory.getSocketFactory()).build();
>         PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(registry);
>         cm.setDefaultMaxPerRoute(10);
>         cm.setMaxTotal(10);
>         if (connectionParams != null && !connectionParams.isEmpty()) {
>             for (Map.Entry<String, List<String>> entry : connectionParams.entrySet())
{
>                 List<String> attributes = entry.getValue();
>                 boolean isSecure = false;
>                 if (HTTPS_PROTOCOL.equals(attributes.get(0))) {
>                     isSecure = true;
>                 }
>                 HttpRoute route = new HttpRoute(new HttpHost(entry.getKey()), null, isSecure);
>                 cm.setMaxPerRoute(route, 10);
>             }
>         }
> 	httpClient = HttpClientBuilder.create().setConnectionManager(cm);
>         HttpGet request = new HttpGet("some uri");
>         request.setConfig(setConnectionTimeout(1000));
>         HttpResponse response = mHTTPClient.execute(request, new BasicHttpContext());



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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


Mime
View raw message