ThreadSafeClientConnManager Connection pool leak issue
-------------------------------------------------------
Key: HTTPCORE-238
URL: https://issues.apache.org/jira/browse/HTTPCORE-238
Project: HttpComponents HttpCore
Issue Type: Bug
Components: HttpCore
Affects Versions: 4.0.1
Reporter: chowdareddy somu
Fix For: 4.0.1
Hi,
We are using the HttpClient4.0.2 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 values ..
Application runs contionusly for 3 to 4 hrs after that its getting the out of
connections and it throws following 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());
.............
}
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)
--
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]