Travis and EOF errors in Gradle

I am only seeing this at the moment with the Travis builds for GradleTest. I’ve turned on debug for the test task in one of the builds and the console output can be seen at

Most significantly I’m seeing

14:38:36.862 [DEBUG] [org.gradle.internal.remote.internal.inet.SocketConnection] Discarding EOFException:
14:38:36.865 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'Gradle Test Executor 2' finished with exit value 137 (state: FAILED)
14:38:36.877 [DEBUG] [TestEventLogger] 

and stuff like

        Caused by:        org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation '/home/travis/.gradle/wrapper/dists/gradle-2.14-all/dmmpvfacc1g089abcvm42kj40/gradle-2.14'.            
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(            

at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(            
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(           
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$            
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(            at org.gradle.internal.concurrent.StoppableExecutorImpl$            
at java.util.concurrent.ThreadPoolExecutor.runWorker(            
at java.util.concurrent.ThreadPoolExecutor$            
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(            
 ... 3 more            
Caused by: org.gradle.launcher.daemon.client.DaemonDisappearedException: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

I’m wondering is a Gradle dev could shed some light on this before I go off to bug the Travis folks

I had exactly the same problem on a build (test) for a simple Android app. My system was a VM with 16.04 Ubuntu. The error used to come from different test cases, in a non-deterministic order. For some, from time-to-time for others over and over again…
After a long search, it turned to be that my VM’s 1GB RAM was simply not enough. After we increased it to 3GB, the problem disappeared completely. So please check your available memory, it might (and most probably will) be the reason.