Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
AngryBaby opened this issue ยท 16 comments
Downloading https://services.gradle.org/distributions/gradle-4.1-all.zip
..................................................................................................................................................................
Unzipping /builds/Ham/android_ci_test_2/.gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew/gradle-4.1-all.zip to /builds/Ham/android_ci_test_2/.gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew
Set executable permissions for: /builds/Ham/android_ci_test_2/.gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew/gradle-4.1/bin/gradle
Starting a Gradle Daemon (subsequent builds will be faster)
The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=4143e059-98fc-47a4-92e5-f4ff25d84dd3.1, currentDir=/builds/Ham/android_ci_test_2}
Attempting to read last messages from the daemon log...
Daemon pid: 34
log file: /builds/Ham/android_ci_test_2/.gradle/daemon/4.1/daemon-34.out.log
----- Last 20 lines from daemon log file - daemon-34.out.log -----
08:42:51.205 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpIncomingConnector] Accepted connection from /127.0.0.1:35556 to /127.0.0.1:33575.
08:42:51.269 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] awaitExpiration() called on daemon
08:42:51.270 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] daemon is running. Sleeping until state changes.
08:42:51.630 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 13: received class org.gradle.launcher.daemon.protocol.Build
08:42:51.630 [DEBUG] [org.gradle.launcher.daemon.server.DefaultDaemonConnection] thread 13: Received non-IO message from client: Build{id=4143e059-98fc-47a4-92e5-f4ff25d84dd3.1, currentDir=/builds/Ham/android_ci_test_2}
08:42:51.630 [INFO] [org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler] Received command: Build{id=4143e059-98fc-47a4-92e5-f4ff25d84dd3.1, currentDir=/builds/Ham/android_ci_test_2}.
08:42:51.631 [DEBUG] [org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler] Starting executing command: Build{id=4143e059-98fc-47a4-92e5-f4ff25d84dd3.1, currentDir=/builds/Ham/android_ci_test_2} with connection: socket connection from /127.0.0.1:33575 to /127.0.0.1:35556.
08:42:51.639 [ERROR] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] Command execution: started DaemonCommandExecution[command = Build{id=4143e059-98fc-47a4-92e5-f4ff25d84dd3.1, currentDir=/builds/Ham/android_ci_test_2}, connection = DefaultDaemonConnection: socket connection from /127.0.0.1:33575 to /127.0.0.1:35556] after 0.0 minutes of idle
08:42:51.639 [INFO] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Marking the daemon as busy, address: [dffbca5f-cabf-463a-bf5a-20cf325d0499 port:33575, addresses:[/127.0.0.1]]
08:42:51.639 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Marking busy by address: [dffbca5f-cabf-463a-bf5a-20cf325d0499 port:33575, addresses:[/127.0.0.1]]
08:42:51.640 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
08:42:51.652 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
08:42:51.653 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
08:42:51.653 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] resetting idle timer
08:42:51.654 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] daemon is running. Sleeping until state changes.
08:42:51.654 [INFO] [org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy] Daemon is about to start building Build{id=4143e059-98fc-47a4-92e5-f4ff25d84dd3.1, currentDir=/builds/Ham/android_ci_test_2}. Dispatching build started information...
08:42:51.655 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 15: dispatching class org.gradle.launcher.daemon.protocol.BuildStarted
08:42:51.699 [DEBUG] [org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment] Configuring env variables: {PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sdk/tools, CI_SERVER_REVISION=be80a97, CI_PROJECT_URL=http://192.168.1.109/Ham/android_ci_test_2, CI_COMMIT_REF_SLUG=master, VERSION_SDK_TOOLS=3859397, CI_PROJECT_PATH_SLUG=ham-android-ci-test-2, ANDROID_HOME=/sdk, PWD=/builds/Ham/android_ci_test_2, CI_SERVER=yes, CI_SERVER_NAME=GitLab, CI_PROJECT_VISIBILITY=private, GITLAB_USER_NAME=?????????, CI_BUILD_NAME=build, CI_RUNNER_TAGS=android, CI_PIPELINE_SOURCE=push, CI_RUNNER_ID=18, OLDPWD=/builds/Ham/android_ci_test_2, CI_REGISTRY_USER=gitlab-ci-token, CI_COMMIT_REF_NAME=master, DEBIAN_FRONTEND=noninteractive, GITLAB_CI=true, CI_JOB_ID=86, GITLAB_USER_ID=6, SHLVL=1, CI_BUILD_REF_NAME=master, CI_SERVER_VERSION=10.4.1, GITLAB_USER_EMAIL=ham@yumlive.com, CI_JOB_STAGE=build, CI_BUILD_REF=5629cf1a846dbe54ac3b1791afa9a0d0d70f302c, CI_PROJECT_ID=9, CI_RUNNER_DESCRIPTION=android app in centos7 docker, CI_REGISTRY_PASSWORD=xxxxxxxxxxxxxxxxxxxx, CI_PROJECT_PATH=Ham/android_ci_test_2, CI_BUILD_STAGE=build, GRADLE_USER_HOME=/builds/Ham/android_ci_test_2/.gradle, CI_PROJECT_NAMESPACE=Ham, CI_PIPELINE_ID=34, CI_DISPOSABLE_ENVIRONMENT=true, CI_BUILD_TOKEN=xxxxxxxxxxxxxxxxxxxx, CI_CONFIG_PATH=.gitlab-ci.yml, CI_BUILD_BEFORE_SHA=ad91479ac98d49c491e4a7c23cce85085259b209, CI_PROJECT_NAME=android_ci_test_2, CI_BUILD_REF_SLUG=master, CI=true, CI_JOB_TOKEN=xxxxxxxxxxxxxxxxxxxx, CI_BUILD_ID=86, HOSTNAME=runner-b7da734c-project-9-concurrent-0, CI_JOB_NAME=build, GITLAB_USER_LOGIN=Ham, CI_PROJECT_DIR=/builds/Ham/android_ci_test_2, CI_REPOSITORY_URL=http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@192.168.1.109/Ham/android_ci_test_2.git, CI_COMMIT_SHA=5629cf1a846dbe54ac3b1791afa9a0d0d70f302c, HOME=/root}
08:42:51.733 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 13: received class org.gradle.launcher.daemon.protocol.CloseInput
08:42:51.733 [DEBUG] [org.gradle.launcher.daemon.server.DefaultDaemonConnection] thread 13: Received IO message from client: org.gradle.launcher.daemon.protocol.CloseInput@2a55902a
----- End of the daemon log -----
FAILURE: Build failed with an exception.
-
What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed) -
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. -
Get more help at https://help.gradle.org
ERROR: Job failed: exit code 1
I don't see how this could be an issue of the Docker image. Have you inspected the container after it died? Especially the State
section? It should tell you a bit more about what happened.
Example:
$ docker inspect my_container_name
[
{
"State": {
"Status": "created",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 127,
"Error": "OCI runtime create failed: container_linux.go:296: starting container process caused \"exec: \\\"/usr/bin/bash\\\": stat /usr/bin/bash: no such file or directory\": unknown",
"StartedAt": "0001-01-01T00:00:00Z",
"FinishedAt": "0001-01-01T00:00:00Z"
}
[...]
@jangrewe
"State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 1752, "ExitCode": 0, "Error": "", "StartedAt": "2018-02-27T02:36:03.361738116Z", "FinishedAt": "2018-02-26T11:14:43.663727688Z" },
@jangrewe
i copy your gitlab-ci.yml to my project and change args, run in the docker, then occur this error
So that's not the container dying, as it's always still Running
.
Does your Gradle task run fine outside of the container?
Did you try, as instructed by Gradle:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I see, your GITLAB_USER_NAME=?????????
is not encoded property in environment variables. This may help: gradle/gradle#3117
Following the advice for this post fixed the issue for me: https://stackoverflow.com/a/47027943 Sounds like Gradle needs more memory than Docker is willing to give it.
@oliverspryn how would one increase the allowed memory when I'm using this in gitlab ci? is there any menu options? or any other way?
As @mj-daft mentioned, the non-ascii GITLAB_USER_NAME may cause this issue.
After add "export GITLAB_USER_NAME=GHOST" in before_script, i workaround this issue
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export GITLAB_USER_NAME=GHOST
- chmod +x ./gradlew
add unicode support to docker image may fix this issue
Running the gradle commands with --no-daemon solved this issue for me. Example:
./gradlew --no-daemon assembleDemoDebug
I'm facing this issue and none of the above works for me. Anyone that can assist, please?
- Running on GitLab CI
- Used --no-daemon but it still starts
- Changed the name but still fails
Don't know what else to try
* Exception is:
org.gradle.launcher.daemon.client.DaemonDisappearedException: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
at org.gradle.launcher.daemon.client.DaemonClient.handleDaemonDisappearance(DaemonClient.java:242)
at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:218)
at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:179)
at org.gradle.launcher.daemon.client.SingleUseDaemonClient.execute(SingleUseDaemonClient.java:54)
at org.gradle.launcher.daemon.client.SingleUseDaemonClient.execute(SingleUseDaemonClient.java:37)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:52)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:207)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:402)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:375)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:37)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:23)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:368)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:298)
at org.gradle.launcher.Main.doAction(Main.java:36)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
* Get more help at https://help.gradle.org
ERROR: Job failed: exit code 1
Searched around and it seems like because I use git-cz
which adds emoticons to the commit messages, it bombs out. This issue is apparently fixed in version 5.3 & above of gradle. Can you update the version, please?
Hi,
I'm using gradle wrapper, so I updated to 5.5.1 version in gradle-wrapper.properties. After this I ran ./gradlew --no-daemon <task>
.
I also added org.gradle.daemon=false
to gradle.properties
This solved my issue
Downgrade gradle to version 5.3
./gradlew wrapper --gradle-version=5.3
This fixed the issue for me.
This thread helped me solve the issue.
Apparently, it's a low-level memory problem - the execution machine isn't able to allocate enough memory for the heap. I've removed the .gradle
directory which freed enough memory for the daemon to be able to work.
You can find the gradle path under Android Studio โ Properties โ search for "gradle"