gradle command is failing as it is not able to start daemon

Tags: , ,



I am trying to run the gradle command. This has worked initially. However it has started failing after some time, as it is not able to start daemon. I am using Gradle 2.5 with IBM jdk 1.6 on Windows 7 Enterprise.

I have cleaned up the .gradle directory in my user home directory and restarted my system.

This is working fine on my friends machine with same versions.
Please help.

org.gradle.api.GradleException: Could not start Gradle daemon.
        at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:137)
        at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startDaemon(DefaultDaemonStarter.java:114)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.startDaemon(DefaultDaemonConnector.java:109)
        at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:87)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:117)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:77)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:40)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:23
7)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:21
0)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.gradle.api.UncheckedIOException: java.io.EOFException
        at org.gradle.launcher.daemon.bootstrap.DaemonStartupCommunication.readDiagnostics(DaemonStartupCommunication.ja
va:100)
        at org.gradle.launcher.daemon.bootstrap.DaemonGreeter.parseDaemonOutput(DaemonGreeter.java:40)
        at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:133)
        ... 24 more
Caused by: java.io.EOFException
        at java.io.DataInputStream.readBoolean(DataInputStream.java:238)
        at org.gradle.internal.serialize.InputStreamBackedDecoder.readBoolean(InputStreamBackedDecoder.java:47)
        at org.gradle.internal.serialize.AbstractDecoder.readNullableString(AbstractDecoder.java:53)
        at org.gradle.launcher.daemon.bootstrap.DaemonStartupCommunication.readDiagnostics(DaemonStartupCommunication.ja
va:85)
        ... 26 more

Answer

Not certain about your scenario (and about IBM jdk) but whenever daemon, or in general any otherwise perfectly working build, suddenly stops working for me, I try two things.

  1. gradle myTask --no-daemon to run build without daemon in order to ensure if it is indeed a problem with daemon.

  2. gradle --stop to kill any existing daemon and then try build again.

There is a word of caution about using daemons on Windows in the gradle docs:

It is also possible to destabilize the Daemon (and build environment in general) by running builds that do not release resources correctly. This is a particularly poignant problem when using Microsoft Windows as it is less forgiving of programs that fail to close files after reading or writing.



Source: stackoverflow