[
https://issues.apache.org/jira/browse/HTTPCLIENT-2193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17470394#comment-17470394
]
Oleg Kalnichevski commented on HTTPCLIENT-2193:
-----------------------------------------------
[~avasilev] I double-checked and tripple-checked and could not find anything of
significance. Here's the exact HttpCore test code I have been using:
{code:java}
public class TestStuff {
public final static void main(final String[] args) throws Exception {
final Provider conscrypt = Conscrypt.newProvider();
Security.insertProviderAt(conscrypt, 1);
// Create and start requester
final H2Config h2Config = H2Config.custom()
.setPushEnabled(false)
.build();
final SSLContext sslContext = SSLContexts.custom()
.setProvider(conscrypt)
.loadTrustMaterial(new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] chain, String
authType) throws CertificateException {
return true;
}
})
.build();
final HttpAsyncRequester requester = H2RequesterBootstrap.bootstrap()
.setH2Config(h2Config)
.setTlsStrategy(new ConscryptClientTlsStrategy(sslContext))
.setStreamListener(LoggingHttp1StreamListener.INSTANCE_SERVER)
.setStreamListener(LoggingH2StreamListener.INSTANCE)
.setIOSessionDecorator(LoggingIOSessionDecorator.INSTANCE)
.setExceptionCallback(LoggingExceptionCallback.INSTANCE)
.setIOSessionListener(LoggingIOSessionListener.INSTANCE)
.create();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
System.out.println("HTTP requester shutting down");
requester.close(CloseMode.GRACEFUL);
}
});
requester.start();
final HttpHost target = new HttpHost("https", "netflix.com", 443);
final String[] requestUris = new String[] {"/"};
final CountDownLatch latch = new CountDownLatch(requestUris.length);
for (final String requestUri: requestUris) {
final Future<AsyncClientEndpoint> future =
requester.connect(target, Timeout.ofDays(5));
final AsyncClientEndpoint clientEndpoint = future.get();
clientEndpoint.execute(
AsyncRequestBuilder.get()
.setHttpHost(target)
.setPath(requestUri)
.build(),
new BasicResponseConsumer<>(new
StringAsyncEntityConsumer()),
new FutureCallback<Message<HttpResponse, String>>() {
@Override
public void completed(final Message<HttpResponse,
String> message) {
clientEndpoint.releaseAndReuse();
final HttpResponse response = message.getHead();
final String body = message.getBody();
System.out.println(requestUri + "->" +
response.getCode() + " " + response.getVersion());
System.out.println(body);
latch.countDown();
}
@Override
public void failed(final Exception ex) {
clientEndpoint.releaseAndDiscard();
System.out.println(requestUri + "->" + ex);
latch.countDown();
}
@Override
public void cancelled() {
clientEndpoint.releaseAndDiscard();
System.out.println(requestUri + " cancelled");
latch.countDown();
}
});
}
latch.await();
System.out.println("Shutting down I/O reactor");
requester.initiateShutdown();
}
}
{code}
> HttpClient Hangs Indefinitely When Using Conscrypt
> --------------------------------------------------
>
> Key: HTTPCLIENT-2193
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2193
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (async)
> Affects Versions: 5.1.2, 5.2-alpha1
> Reporter: Andrei Vasilev
> Priority: Minor
> Attachments: Main.java, amazon(FAILURE).log, build.gradle,
> google(SUCCESS).log, log4j2.xml, netflix(FAILURE).log, yahoo(SUCCESS).log
>
>
> When using an alternative security provider such as Conscrypt, requests will
> fail the majority of the time, hanging indefinitely at various points during
> the request / response process.
> All requests appear to successfully CONNECT, but retrieving data is very
> intermittent. Either the entity is not streamed at all, partially streamed,
> or fully streamed but the client then hangs forever. I let it run for 3
> hours, and even then the client didn't shutdown.
> As you can see in the logs I have attached, requests to some major websites
> will fail at different steps. I have also attached a minimally re-produceable
> example program. I tested this with OkHttp client and all requests work just
> fine using Conscrypt. Not sure what's going on.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]