It’s possible that earlier discussions here, here, and here are related, although I’m concerned about HttpClientHelper in particular. The root cause might be one or more bugs in JRE: JDK-8049846 and JDK-8075484. While these were fixed Sept-13-2016 (unreleased at time of this post), changes appear to be for non-Windows platforms and I’m observing problems on Windows. Some applications have developed workarounds, e.g. Docker.
Here is a thread call stack taken from Eclipse when debugging Gradle when it hangs (also seen by jstack). I suspended the thread to copy the call stack; otherwise it would still be running but hung. In short:
SocketInputStream.socketRead0(FileDescriptor, byte, int, int, int) line: not available [native method] SocketInputStream.socketRead(FileDescriptor, byte, int, int, int) line: 116 SocketInputStream.read(byte, int, int, int) line: 170 ... HttpClientHelper.performHttpRequest(HttpRequestBase) line: 102
Even when Gradle doesn’t hang the majority of time is spent in HttpClientHelper. My company uses ArtifactoryOnline and our build times are very inconsistent. One colleague can reproduce the hang every time. I myself see the hang once every couple of weeks but do see frequent slowdowns. Here is a report from YourKit.
So can Gradle developers implement a workaround ASAP or even investigate fixing the root cause? I have observed these hangs in Gradle 2.10 through 3.1.