GRADLE_DAEMON_IDLE_TIMEOUT cicd system_error ai_generated true

org.gradle.launcher.daemon.server.DaemonExpirationPeriodicCheck: Daemon will be stopped at the end of the build after running for 3 hours and 30 minutes of idle time

ID: cicd/gradle-daemon-stopped-build

Also available as: JSON · Markdown · 中文
75%Fix Rate
85%Confidence
1Evidence
2023-11-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Gradle 7.6 active
Gradle 8.0 active
Gradle 8.5 active

Root Cause

Gradle daemon was idle for too long and will be terminated, causing subsequent builds to restart a new daemon and lose cache benefits.

generic

中文

Gradle守护进程空闲时间过长将被终止,导致后续构建需重新启动守护进程并丢失缓存优势。

Official Documentation

https://docs.gradle.org/current/userguide/gradle_daemon.html

Workarounds

  1. 85% success Set a reasonable idle timeout in gradle.properties: org.gradle.daemon.idletimeout=3600000 (1 hour) and ensure CI jobs complete within that window. Also use --build-cache to persist outputs.
    Set a reasonable idle timeout in gradle.properties: org.gradle.daemon.idletimeout=3600000 (1 hour) and ensure CI jobs complete within that window. Also use --build-cache to persist outputs.
  2. 90% success Run 'gradle --stop' before starting a new build to force a fresh daemon, or configure CI to reuse the same daemon across steps by not exiting the JVM.
    Run 'gradle --stop' before starting a new build to force a fresh daemon, or configure CI to reuse the same daemon across steps by not exiting the JVM.

中文步骤

  1. Set a reasonable idle timeout in gradle.properties: org.gradle.daemon.idletimeout=3600000 (1 hour) and ensure CI jobs complete within that window. Also use --build-cache to persist outputs.
  2. Run 'gradle --stop' before starting a new build to force a fresh daemon, or configure CI to reuse the same daemon across steps by not exiting the JVM.

Dead Ends

Common approaches that don't work:

  1. 65% fail

    Simply increasing idle timeout may mask underlying memory issues or long-running CI jobs that should be optimized, and doesn't fix the root cause of long build times.

  2. 80% fail

    Disabling the daemon removes caching and warm JVM benefits, making builds significantly slower (up to 50% slower) in CI environments.