DAEMON_EXPIRATION cicd runtime_error ai_generated true

Gradle守护进程将在构建结束后停止,因为运行了3小时,超过了2小时的闲置超时时间。

org.gradle.launcher.daemon.server.DaemonExpirationPeriodicCheck: Daemon will be stopped at the end of the build after running for 3 hours and exceeding the 2-hour idle timeout.

ID: cicd/gradle-daemon-stopped-before-finish

其他格式: JSON · Markdown 中文 · English
82%修复率
85%置信度
1证据数
2023-06-15首次发现

版本兼容性

版本状态引入弃用备注
Gradle 7.5 active
Gradle 8.0 active
Gradle 8.2 active

根因分析

Gradle守护进程配置了较低的闲置超时时间(例如2小时),而构建运行时间超过了该时间,导致守护进程在构建完成前被终止,尤其在长时间运行的CI任务中。

English

Gradle Daemon is configured with a low idle timeout (e.g., 2 hours) and the build runs longer than that, causing the daemon to be killed before the build completes, especially on long-running CI jobs.

generic

官方文档

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

解决方案

  1. Increase the daemon idle timeout in gradle.properties: org.gradle.daemon.idletimeout=7200000 (2 hours in milliseconds) or set it to 0 to disable idle timeout.
  2. Disable the Gradle Daemon for CI builds by adding --no-daemon to the Gradle command, forcing a new JVM for each build.
  3. Split the build into smaller, parallel tasks to reduce individual build time below the idle timeout threshold.

无效尝试

常见但无效的做法:

  1. 75% 失败

    The daemon idle timeout is a Gradle configuration parameter, not a cache or runner issue.

  2. 80% 失败

    Heap size affects memory, not the daemon's idle timeout behavior.

  3. 70% 失败

    The timeout is set in gradle.properties or via command line flags, not by installation.