Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jolokia Java-Client is throwing ConnectionPoolTimeoutException with PooledHttpClient #309

Closed
bcubk opened this issue Mar 9, 2017 · 0 comments · Fixed by #336
Closed

Comments

@bcubk
Copy link
Contributor

bcubk commented Mar 9, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant