I am getting the dreaded java.io.StreamCorruptedException when running Gradle tests. I understand that this happens if you System.exit() in your tests but I’ve searched the source code for instances of System.exit() and haven’t found any so I’m at a loss as to how to fix this problem. There are no stack traces in the test standard streams output. This is blocking me from migrating our Ant build to Gradle.
Using Gradle 1.8, but saw similar things with 1.7
Unexpected exception thrown. org.gradle.messaging.remote.internal.MessageIOException: Could not read message from ‘/0:0:0:0:0:0:0:1:61275’.
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.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744) Caused by: java.io.StreamCorruptedException: unexpected block data
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1364)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at org.gradle.messaging.remote.internal.Message$ExceptionPlaceholder.read(Message.java:101)
at org.gradle.messaging.remote.internal.Message$ExceptionPlaceholder.getCause(Message.java:129)
at org.gradle.messaging.remote.internal.Message$ExceptionPlaceholder.read(Message.java:88)
at org.gradle.messaging.remote.internal.Message$ExceptionPlaceholder.getCause(Message.java:129)
at org.gradle.messaging.remote.internal.Message$ExceptionPlaceholder.read(Message.java:88)
at org.gradle.messaging.remote.internal.Message$ExceptionReplacingObjectInputStream.resolveObject(Message.java:166)
at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1398)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1706)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1344)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at org.gradle.messaging.remote.internal.Message.receive(Message.java:38)
at org.gradle.messaging.serialize.kryo.JavaSerializer$JavaReader.read(JavaSerializer.java:50)
at org.gradle.messaging.remote.internal.hub.MethodInvocationSerializer$MethodInvocationReader.readArguments(MethodInvocationSerializer.java:112)
at org.gradle.messaging.remote.internal.hub.MethodInvocationSerializer$MethodInvocationReader.read(MethodInvocationSerializer.java:107)
at org.gradle.messaging.remote.internal.hub.MethodInvocationSerializer$MethodInvocationReader.read(MethodInvocationSerializer.java:87)
at org.gradle.messaging.serialize.kryo.TypeSafeSerializer$1.read(TypeSafeSerializer.java:37)
at org.gradle.messaging.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:67)
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)