[
https://issues.apache.org/jira/browse/HTTPCLIENT-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920738#action_12920738
]
Oleg Kalnichevski commented on HTTPCLIENT-1012:
-----------------------------------------------
> My question is there if any socket connection exception happens while
> executing the Http Request then the response object
> is null so there is nothing to consume the content, what happens in this
> case..
connection will be shut down and automaticaly released back to the pool
> will that connection is going back to the pool?
Yes, it will
> If I close the expiry connection using the closeExpiredConnections() method ,
> will it create new connection for that??
Those connections will be evicted from the pool and new connections will be
created when needed
> I don't understand why it says, connection Closed, connection shut down and
> released connection is not reusable?
The log is somewhat noisy. Basically if a connection throws an exception
(including socket timeout) in the course of HTTP request execution HttpClient
shuts down that connection as it may be left in a inconsistent state and
therefore considered non-reusable.
_Please_ post your questions to the HttpClient user list. Jira is not a support
forum.
Oleg
> ThreadSafeClientConnManager Connection pool leak issue
> -------------------------------------------------------
>
> Key: HTTPCLIENT-1012
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1012
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpConn
> Affects Versions: 4.0.3
> Reporter: chowdareddy somu
>
> Hi,
> We are using the HttpClient4.0.3(latest) version for our application where we
> need to serve the http request to our web app by calling the underlying
> services.
> Application gets an average 50 threads at a time and we are maintaining the
> connection pool on per host basis. we configured the following HttpParam
> values.. And we are calling the abort() and consumeContent() methods if there
> are any exceptions due to backed service problem, and for success requests we
> are extracting the response using the get content method( InputStream is =
> httpResponse.getEntity().getContent())
> Application runs contionusly for 3 to 4 hrs fine, after that its getting the
> out of connections and it throws below exception..
> Config Values
> http.connection.timeout = 5000
> http.socket.timeout = 300000
> http.conn-manager.timeout = 1000
> http.conn-manager.max-per-route = 100
> http.conn-manager.max-total = 100
> private static HttpConnectionManagerFactory instance = null;
> private Map<String, ClientConnectionManager> map = new HashMap<String,
> ClientConnectionManager>();
> private HttpConnectionManagerFactory() {
> }
> public static synchronized HttpConnectionManagerFactory getInstance() {
> if (instance == null) {
> instance = new HttpConnectionManagerFactory();
> }
> return instance;
> }
> public synchronized ClientConnectionManager getConnectionManager(URI
> uri) {
> if (!map.containsKey(uri.getHost())) {
> HttpParams params =
> HttpProperties.getInstance().getHttpParams(uri);
> SchemeRegistry registry = new SchemeRegistry();
> Scheme http = new Scheme("http",
> PlainSocketFactory.getSocketFactory(), 80);
> registry.register(http);
> map.put(uri.getHost(), new
> ThreadSafeClientConnManager(params, registry));
> }
> return map.get(uri.getHost());
> }
> public HttpClient getClient(HttpUriRequest request) {
> ClientConnectionManager connectionManager =
> HttpConnectionManagerFactory.getInstance().getConnectionManager(request.getURI());
> HttpParams params =
> HttpProperties.getInstance().getHttpParams(request.getURI());
> .............
> }
> HttpClient httpClient =
> HttpClientFactory.getInstance().getClient(httpRequest);
> tracker.startTimer();
> HttpResponse httpResponse = null;
> try {
> try {
> httpResponse =
> httpClient.execute(httpRequest);
> } finally {
> tracker.stopTimer();
> }
> StatusLine statusLine =
> httpResponse.getStatusLine();
> tracker.setStatusLine(statusLine);
> ..........................
> }
> Caused by: java.io.IOException:
> org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for
> connection
> at
> com.proquest.services.ems.service.HttpRetrieve.getFollowingRedirection(HttpRetrieve.java:194)
> at
> com.proquest.services.ems.service.MorningstarMediaService.resolveResource(MorningstarMediaService.java:73)
> ... 46 more
> Caused by: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout
> waiting for connection
> at
> org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:345)
> at
> org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:228)
> at
> org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConnection(ThreadSafeClientConnManager.java:172)
> at
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:390)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
> at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
> at
> com.proquest.services.ems.service.HttpRetrieve.getFollowingRedirection(HttpRetrieve.java:155)
> any idea???
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]