Improve error message when tests fail due to memory issues

Not sure if this is possible or not but I ran into a problem with a testng test suite I was running. The issue turned out in the end to be the fact that I did not specify enough memory in the jvm arguments used when starting up the jvm that executes the tests.

However, the actually error I got did not help at all in trying to troubleshoot the issue. Here’s the error message I got:

org.gradle.messaging.remote.internal.MessageIOException: Could not read message from ‘/0:0:0:0:0:0:0:1%0:61445’.

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:66)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)

at java.lang.Thread.run(Thread.java:680) 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

It took about an hour to troubleshoot and just ended up guessing the solution. I couldn’t find any output anywhere that could provide me the actual cause of the error.

I was using gradle 1.7

Thanks.