3

How do I determine why my Gradle Daemon died? The only message I get isL

Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

This occurs in an active build. Several steps will finish and a step will appear to be active and then the build fails.

This began after moving our memory args (Xmx Xms PermGen) from a shell script that called gradlew to gradle.properties and calling gradlew directly.

build.sh

export GRADLE_OPTS="\"-Xmx1024m\" \"-Xms256m\" \"-XX:MaxPermSize=256m\""
export JAVA_HOME="/usr/local/java/jdk1.6"
exec ./gradlew "$@"

Addition to gradle.properties

org.gradle.java.home=/usr/local/java/jdk1.6/
org.gradle.jvmargs=-Xmx1024m -Xms256m -XX:MaxPermSize=256m

After this change Gradle warns:

To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html

And even though we don't ask it to, the build is running in a daemon, which ultimately fails.

Will
  • 24,082
  • 14
  • 97
  • 108
Jacob Tomaw
  • 1,341
  • 1
  • 10
  • 15
  • 1
    Is this a consistent failure? Running gradle with --info or --debug flags might give you a hint for that – Amnon Shochot Apr 15 '15 at 20:51
  • How long since you last built something using the daemon, before it died? – Jolta Apr 15 '15 at 21:25
  • It is fairly consistent. I am going to try with --info or --debug, but my assumption was I won't get much because the process will not have the info it is the daemon that has it. – Jacob Tomaw Apr 16 '15 at 12:41
  • @Jolta I should have noted that this happens mid-build. This build takes 3.5 hours when successful. Sometimes it fails 17 min in sometimes a couple hours in. There are some predictable patterns but I don't know what to fix. – Jacob Tomaw Apr 16 '15 at 12:43
  • Guess it is `OutOfMemory` :) Can you post the relevant diff of build script and gradle.properties? – barti_ddu Apr 16 '15 at 12:58
  • @barti_ddu Great suggestion and I have done so. Now that I have added it I wonder if the spaces could be an issue. – Jacob Tomaw Apr 16 '15 at 13:43
  • @JacobTomaw: nope, your settings look ok. However, make sure that they are not overridden somewhere (e.g. AFAIR `~/.gradle` has precedence against project directory). – barti_ddu Apr 16 '15 at 14:44

1 Answers1

1

Gradle build daemon disappeared unexpectedly most frequently occurs when something else kills the long-running Gradle Daemon process and the client process (the Daemon uses local TCP connections to communicate) tries to send a message and gets no response.

For example, running gradle --stop or killall java while a build is occurring will reproduce this problem.

Eric Wendelin
  • 43,147
  • 9
  • 68
  • 92