jira-importer opened a new issue, #1288: URL: https://github.com/apache/httpcomponents-core/issues/1288
**[Pavlin Shterev](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER312221)** opened **[HTTPCORE-791](https://issues.apache.org/jira/browse/HTTPCORE-791?redirect=false)** and commented We're configuring a org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient with a socks proxy and all possible timeouts. When there are issues with the socks proxy (different cases - no response from the proxy or a TCP reset) resolving the future returned by the execute() method call can block forever every 2nd failed method call (clarification later). I have a test that simulates issues with the socks proxy and can simulate no response or TCP reset. So if I configure to have TCP reset from the socks proxy and call httpClient.execute() - this fails with socket exception - which is expected. But if I call it again then the future is never resolved and the calling thread is blocked forever. And just for context if after a failed execute() I have a successful one, then the next failed one fails expectedly. The issue reproduces only when there are 2 consecutive execute() calls while having issues with the socks proxy (I'm simulating different issues with the socks proxy and in all cases we have the same problem). This is how we create the client: final SSLContext sslContext = SSLContexts.custom() .loadTrustMaterial(null, TrustAllStrategy.INSTANCE) .build(); TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create() .setSslContext(sslContext) .setHostnameVerifier(NoopHostnameVerifier.INSTANCE) .buildAsync(); Proxy proxy = // get socks proxy address from somewhere IOReactorConfig ioReactorConfigBuilder = IOReactorConfig.custom() .setSocksProxyAddress(proxy.address()) .setSoTimeout(Timeout.ofSeconds(10)) .build(); final PoolingAsyncClientConnectionManager cmAsync = PoolingAsyncClientConnectionManagerBuilder.create() .setTlsStrategy(tlsStrategy) .setPoolConcurrencyPolicy(PoolConcurrencyPolicy.STRICT) .setConnPoolPolicy(PoolReusePolicy.LIFO) .setDefaultConnectionConfig( ConnectionConfig.custom() .setConnectTimeout(Timeout.ofSeconds(5)) .setSocketTimeout(Timeout.ofSeconds(5)) .setTimeToLive(TimeValue.ofSeconds(10)) .build()) .build(); HttpAsyncClientBuilder builder = HttpAsyncClientBuilder.create(); builder.setConnectionManager(cmAsync) .setIOReactorConfig(ioReactorConfigBuilder) .setDefaultRequestConfig(RequestConfig.custom() .setConnectTimeout(Timeout.ofSeconds(5)) .setResponseTimeout(Timeout.ofSeconds(5)) .setConnectionRequestTimeout(Timeout.ofSeconds(5)) .build()); http5Client = builder.build(); http5Client.start(); Making the request: String url = String.format("https://%s:%d/", host, port); SimpleHttpRequest request = SimpleHttpRequest.create(Method.GET, new URI(url)); Future\<SimpleHttpResponse> future = http5Client.execute(request, null); final SimpleHttpResponse response = future.get(); <<<<< THIS POTENTIALLY BLOCKS FOREVER --- **Affects:** 5.4 **Attachments:** - [logs_and_threaddump.zip](https://issues.apache.org/jira/secure/attachment/13080401/logs_and_threaddump.zip) (_682.34 kB_) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
