-
Notifications
You must be signed in to change notification settings - Fork 238
Description
We're running the Jolokia-Client in the version 1.3.4 with default timeouts and get following exception:
Caused by: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.leaseConnection(PoolingHttpClientConnectionManager.java:250) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$1.get(PoolingHttpClientConnectionManager.java:227) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:173) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57) at org.jolokia.client.J4pClient.execute(J4pClient.java:190) ... 8 more
We digged into the code and found propably a bug in the J4pRequestHandler#extractJsonResponse method. In the finally-Block there is following routine:
HttpEntity entity = pHttpResponse.getEntity();
try {
// getContent()
finally {
if (entity != null) {
entity.consumeContent();
}
}The entity.consumeContent(); is deprecated since Apache HTTPClient 4.1 (see https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpEntity.html#consumeContent()), because it doesn't ensures that the entity content is fully consumed.
Without this procedure the content stream still exists and the connection cannot be released.