You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "fanglikui (Jira)" <ji...@apache.org> on 2020/06/15 09:48:00 UTC

[jira] [Created] (HTTPCLIENT-2089) Connection pool shut down" error occurred When using HttpClient to send request. What is the reason?

fanglikui created HTTPCLIENT-2089:
-------------------------------------

             Summary: Connection pool shut down" error occurred When using HttpClient to send request. What is the reason?
                 Key: HTTPCLIENT-2089
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2089
             Project: HttpComponents HttpClient
          Issue Type: Bug
            Reporter: fanglikui


public PoolingHttpClientManager(int maxTotal, int maxPerRoute, SSLConnectionSocketFactory sslConnFactory) {
 this.maxTotal = maxTotal;
 this.maxPerRoute = maxPerRoute;

 Registry<ConnectionSocketFactory> registry = null;
 registry = RegistryBuilder.<ConnectionSocketFactory>create().register(HTTP_PROTOCOL,
 PlainConnectionSocketFactory.getSocketFactory()).register(HTTPS_PROTOCOL, sslConnFactory).build();

 this.gcm = new PoolingHttpClientConnectionManager(registry);
 this.gcm.setMaxTotal(this.maxTotal);
 this.gcm.setDefaultMaxPerRoute(this.maxPerRoute);
 this.gcm.setValidateAfterInactivity(TimeValue.ofMilliseconds(IDLE_CONNECTION_CHECK_SPAN));
}

I used the upper configuration to get the connection pool, and get the httpclient builder as following:

HttpClients.custom()
 .setConnectionManager(this.gcm)
 .setConnectionManagerShared(true)
 .setKeepAliveStrategy(getKeepAliveStrategy())
 .setDefaultRequestConfig(requestConfig);

The I got the following error:

java.lang.IllegalStateException: Connection pool shut down
 at org.apache.hc.core5.util.Asserts.check(Asserts.java:38) ~[httpcore5-5.0.jar:5.0]
 at org.apache.hc.core5.pool.StrictConnPool.lease(StrictConnPool.java:173) ~[httpcore5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.lease(PoolingHttpClientConnectionManager.java:264) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.acquireEndpoint(InternalExecRuntime.java:103) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:118) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:165) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:93) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:128) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:178) ~[httpclient5-5.0.jar:5.0]
 at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:96) ~[httpclient5-5.0.jar:5.0]

 

Can anyone help me?

Thanks.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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