GDAEMONEXPIRED cicd system_error ai_generated partial

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

ID: cicd/gradle-daemon-stopped

Also available as: JSON · Markdown · 中文
78%Fix Rate
83%Confidence
1Evidence
2024-01-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Gradle 8.5 active
Gradle 8.7 active
Gradle 7.6.3 active

Root Cause

Gradle's daemon process is automatically terminated due to idle timeout or maximum age limits configured in gradle.properties, causing subsequent builds to restart the daemon and lose cached state.

generic

中文

Gradle 的守护进程由于在 gradle.properties 中配置的空闲超时或最大年龄限制而自动终止,导致后续构建重启守护进程并丢失缓存状态。

Official Documentation

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

Workarounds

  1. 85% success Increase daemon idle timeout in gradle.properties: `org.gradle.daemon.idletimeout=7200000` (2 hours)
    Increase daemon idle timeout in gradle.properties: `org.gradle.daemon.idletimeout=7200000` (2 hours)
  2. 80% success Set daemon max age to a higher value: `org.gradle.daemon.registry.base.expiration=86400000` (24 hours) in gradle.properties
    Set daemon max age to a higher value: `org.gradle.daemon.registry.base.expiration=86400000` (24 hours) in gradle.properties
  3. 75% success Use the `--no-daemon` flag for short-lived CI builds to avoid daemon overhead, and rely on build cache instead: `gradle build --no-daemon --build-cache`
    Use the `--no-daemon` flag for short-lived CI builds to avoid daemon overhead, and rely on build cache instead: `gradle build --no-daemon --build-cache`

中文步骤

  1. Increase daemon idle timeout in gradle.properties: `org.gradle.daemon.idletimeout=7200000` (2 hours)
  2. Set daemon max age to a higher value: `org.gradle.daemon.registry.base.expiration=86400000` (24 hours) in gradle.properties
  3. Use the `--no-daemon` flag for short-lived CI builds to avoid daemon overhead, and rely on build cache instead: `gradle build --no-daemon --build-cache`

Dead Ends

Common approaches that don't work:

  1. Set org.gradle.daemon=false in gradle.properties to disable daemon entirely 75% fail

    Disabling the daemon removes the caching benefit entirely, making builds significantly slower in CI environments.

  2. Increase the daemon heap size with -Xmx to prevent memory-related stops 90% fail

    Heap size does not affect the idle timeout or age-based expiration; the daemon will still stop after the configured duration.

  3. Restart the CI worker node to clear the daemon lock file 60% fail

    Restarting the node resets the daemon but does not address the underlying configuration causing the expiration.