HttpClient SSL Race Condition

August Nagro augustnagro at gmail.com
Sun Feb 3 03:38:40 UTC 2019


Hello,

When using multiple threads to send HttpRequests from a static final
HttpClient instance, I noticed that CPU use spikes after a minute or so.

I created a reproducible example that I've tested on Java 11.0.2 and
13-ea:  https://gist.github.com/AugustNagro/fec5f7895bd8bb5db66f2ed9cfafc35c

This bug never occurs when using a single thread. Also, switching TLS to
1.2 or 1.1 does not fix the issue. Looking at VisualVM it seems that
SSLFlowDelegate is entering some sort of race condition.

Is this a bug in java.net.HttpClient, or should I not be accessing the
HttpClient from multiple threads?

Regards,

August Nagro

PS: Could this be related to (fixed)
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8217094?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190202/d8de9961/attachment.html>


More information about the net-dev mailing list