JUnit Suite "test" task hangs, never completes

When I kill the stuck worker process, here is the generated stack trace by the parent:

Unexpected exception thrown.
org.gradle.messaging.remote.internal.MessageIOException: Could not read message from '/0:0:0:0:0:0:0:1:54245'.
 at org.gradle.messaging.remote.internal.inet.SocketConnection.receive(SocketConnection.java:88)
 at org.gradle.messaging.remote.internal.hub.MessageHub$ConnectionReceive.run(MessageHub.java:230)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 at java.lang.Thread.run(Thread.java:722)
Caused by: com.esotericsoftware.kryo.KryoException: Buffer underflow.
 at com.esotericsoftware.kryo.io.Input.require(Input.java:162)
 at com.esotericsoftware.kryo.io.Input.readByte(Input.java:255)
 at org.gradle.messaging.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:64)
 at org.gradle.messaging.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:53)
 at org.gradle.messaging.remote.internal.inet.SocketConnection.receive(SocketConnection.java:83)
 ... 5 more

I’ve tried this on Gradle 1.7 and Gradlew 1.10. They both freeze, and consistently in the same place. I could potentially provide a thread dump, or something else. Full logs would be overkill since it only hangs after successfully running through 1000+ tests, though here is a snippet of the debug output when it hangs:

16:46:11.812 [DEBUG] [TestEventLogger] Gradle Worker 171 PASSED
16:46:11.815 [QUIET] [system.out] 16:46:11.814 [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Completed Gradle Worker 171.
16:46:11.818 [QUIET] [system.out] 16:46:11.818 [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Stopping client connection.
16:46:11.837 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: SUCCEEDED
16:46:11.837 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'Gradle Worker 171' finished with exit value 0 (state: SUCCEEDED)
> Building 6% > :project:test > 1264 tests completed2014-02-03 16:51:03

Suggestsions?

We haven’t had any luck trying to consistently reproduce this kind of problem.

Could you try narrowing it down to something you could send us that reproduces?