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:54:00 UTC

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

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-2089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17135697#comment-17135697 ] 

fanglikui commented on HTTPCLIENT-2089:
---------------------------------------

I don't use httpClient.close() method to close the connection.

> "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
>            Priority: Major
>
>  
> _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 got the httpclient builder as following:*
> _HttpClients.custom()_
>  _.setConnectionManager(this.gcm)_
>  _.setConnectionManagerShared(true)_
>  _.setKeepAliveStrategy(getKeepAliveStrategy())_
>  _.setDefaultRequestConfig(requestConfig);_
> Then 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