Hello HttpClient developers, A user of our application SonarLint recently reported an issue (see thread <https://community.sonarsource.com/t/cpu-reaches-too-100-on-intellij-randomly/57710>). After some hours of use or after waking up the PC, the OP can barely use it since all CPUs are busy. It is the first time we receive such a report. As mentioned in the thread I found similar bug reports in different tools or in the JDK itself, but nothing was fixed.
After investigation it appears that all httpclient-dispatch-* threads occupy 100% of the CPU. As we use the default configuration there are 24 JVM threads on this user's box (one per CPU thread). From the snapshot sent by the OP it seems that the time is spent in sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(long, int, int[], int[], int[], long, long), which is a native method. Maybe the Selector.select() always returns immediately ? Our application uses HttpClient 5.1.2. The config of the client can be found here <https://github.com/SonarSource/sonarlint-intellij/blob/master/src/main/java/org/sonarlint/intellij/http/ApacheHttpClient.kt#L114>. I don't have a reproducer but everything we do with HC is in this file. My guess is that it's not a bug with HttpClient itself, but rather in lower levels, maybe JDK, OS or network drivers. I'm asking for some help here: * I don't know if my reasoning is correct or not * I don't know how to find the root cause * If it's indeed a bug in a lower-level piece of code (e.g. JDK) I don't know how to escalate. * also if it's the case maybe some workaround could be put in place in HttpClient. Happy to help debug this problem, and thank you for developing this lib! Damien Urruty | SonarSource Developer https://sonarsource.com <http://sonarsource.com/> Are you using SonarLint <http://www.sonarlint.org> in your IDE?