Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle build fail: Process 'Gradle Test Executor 1' finished with non-zero exit value 1

Tags:

java

gradle

Gradle build fails when it gets to the :test task (junit tests). It gives the error

Process 'Gradle Test Executor 1' finished with non-zero exit value 1

I am using gradle with a java project in eclipse. Gradle 1.12 and Java 7. The problem seems to be happening when a test is run on a class that connects to a database. The odd thing is that the program and tests work fine as java applications. There are no problems with the database connection and it compiles and runs correctly. Does gradle do something that could mess with how it connects to external database servers? The problem could have nothing to do with the database so any solution is appreciated. I've looked online and on the official gradle site but nothing was helpful. Thanks.

EDIT

Debug results:

14:23:28.661 [DEBUG] [TestEventLogger] 
14:23:28.661 [DEBUG] [TestEventLogger] Test Run PASSED
14:23:28.665 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':test'
14:23:28.665 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :test FAILED
14:23:28.665 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :test (Thread[main,5,main]) completed. Took 5.552 secs.
14:23:28.666 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 6.67 secs, idle: 0.021 secs
14:23:28.808 [LIFECYCLE] [org.gradle.BuildResultLogger] 
14:23:28.808 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
14:23:28.808 [LIFECYCLE] [org.gradle.BuildResultLogger] 
14:23:28.808 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 11.75 secs
14:23:28.811 [DEBUG] [org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonManager] Stopping 0 compiler daemon(s).

Error Message:

Unexpected exception thrown.
org.gradle.messaging.remote.internal.MessageIOException: Could not read message from '/127.0.0.1:51041'.
    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:745)
Caused by: com.esotericsoftware.kryo.KryoException: java.io.IOException: An existing connection was forcibly closed by the remote host
    at com.esotericsoftware.kryo.io.Input.fill(Input.java:141)
    at com.esotericsoftware.kryo.io.Input.require(Input.java:159)
    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
Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
    at sun.nio.ch.SocketDispatcher.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
    at org.gradle.messaging.remote.internal.inet.SocketConnection$SocketInputStream.read(SocketConnection.java:167)
    at com.esotericsoftware.kryo.io.Input.fill(Input.java:139)
    ... 10 more
Unexpected exception thrown.
org.gradle.messaging.remote.internal.MessageIOException: Could not write message [EndOfStream] to '/127.0.0.1:51041'.
    at org.gradle.messaging.remote.internal.inet.SocketConnection.dispatch(SocketConnection.java:115)
    at org.gradle.messaging.remote.internal.hub.MessageHub$ConnectionDispatch.run(MessageHub.java:279)
    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:745)
Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:51)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
    at org.gradle.messaging.remote.internal.inet.SocketConnection$SocketOutputStream.flush(SocketConnection.java:230)
    at org.gradle.messaging.remote.internal.inet.SocketConnection.dispatch(SocketConnection.java:113)
    ... 5 more
 FAILED
like image 367
user3195786 Avatar asked May 07 '14 16:05

user3195786


2 Answers

Try cleaning your daemons with ./gradlew --stop. It works for me. This was my error. also sometimes I got an IDLE at the end of the build and never ends.

* What went wrong:
Execution failed for task ':test'.
> A problem occurred starting process 'Gradle Test Executor 1'
like image 147
Ali Avatar answered Oct 05 '22 06:10

Ali


Most probably one of your test go through a System.exit(1).

It may help to display the test result in console using test -i.

like image 20
user1707414 Avatar answered Oct 05 '22 05:10

user1707414