liqiang.liu created HTTPCLIENT-2256:
---------------------------------------

             Summary: The CloseableHttpClient is shut down due to an 
java.lang.StackOverflowError exception
                 Key: HTTPCLIENT-2256
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2256
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (classic)
    Affects Versions: 4.5.13
            Reporter: liqiang.liu
         Attachments: image-2023-01-11-20-25-17-784.png

builded the  CloseableHttpClient  via  the code 

 

~private static final CloseableHttpClient HttpClient = bulidClient();~

~private static CloseableHttpClient bulidClient() {~
 ~HttpClientBuilder httpClientBuilder = 
HttpClients.custom().setMaxConnTotal(1000).setMaxConnPerRoute(1000);~
 
~httpClientBuilder.setDefaultRequestConfig(RequestConfig.custom().setConnectionRequestTimeout(2000).setConnectTimeout(3000).setSocketTimeout(4000).build());~
 
~httpClientBuilder.setDefaultSocketConfig(SocketConfig.custom().setSoLinger(0).setSoKeepAlive(false).setTcpNoDelay(true).setSoTimeout(4000).build());~
 
~httpClientBuilder.setDefaultConnectionConfig(ConnectionConfig.custom().setBufferSize(8192).build());~
 ~httpClientBuilder.setRetryHandler(new DefaultHttpRequestRetryHandler(2, 
false));~
 ~return httpClientBuilder.setConnectionManagerShared(true).build();~
~}~

 

The HttpClient becomes unavailable when a  java.lang.StackOverflowError  
occurs. Even if the jvm recovers.  I found out why:

class MainClientExec in the source code closes the connection pool when an 
StackOverflowError occurs, causing the client to fail to recover. 

 

!image-2023-01-11-20-25-17-784.png!

 

I expect it to keep working when something goes wrong



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to