{
  "id": "cicd/gradle-daemon-stopped-after-build",
  "signature": "org.gradle.launcher.daemon.server.DaemonExpirationPeriodicCheck: Daemon will be stopped at the end of the build after running for X hours and not being used for Y hours",
  "signature_zh": "Gradle守护进程将在构建结束后停止，因为已运行X小时且未使用Y小时",
  "regex": "org\\.gradle\\.launcher\\.daemon\\.server\\.DaemonExpirationPeriodicCheck: Daemon will be stopped at the end of the build after running for .* hours and not being used for .* hours",
  "domain": "cicd",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "Gradle daemon reaches its idle timeout (default 3 hours) or maximum age (default 24 hours) during a CI build, causing it to be stopped prematurely, which can lead to build failures if the daemon is needed for subsequent tasks.",
  "root_cause_type": "generic",
  "root_cause_zh": "Gradle守护进程在CI构建期间达到空闲超时（默认3小时）或最大存活时间（默认24小时），导致被提前停止，如果后续任务需要该守护进程，可能导致构建失败。",
  "versions": [],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Set org.gradle.daemon=false in gradle.properties to disable daemon entirely",
      "why_fails": "Disabling daemon forces a new JVM for each build, increasing startup time and memory overhead, and may cause other race conditions in CI pipelines.",
      "fail_rate": 0.2,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase max heap size for daemon (org.gradle.jvmargs=-Xmx4g) to avoid memory pressure",
      "why_fails": "Heap size does not affect idle timeout; the daemon is stopped based on time, not memory usage, so this fix is irrelevant.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set org.gradle.daemon.idletimeout=7200000 in gradle.properties to increase idle timeout to 2 hours (value in milliseconds). Also set org.gradle.daemon.registrybase=/tmp/gradle-daemon to avoid PID file conflicts in CI.",
      "success_rate": 0.85,
      "how": "Set org.gradle.daemon.idletimeout=7200000 in gradle.properties to increase idle timeout to 2 hours (value in milliseconds). Also set org.gradle.daemon.registrybase=/tmp/gradle-daemon to avoid PID file conflicts in CI.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Run Gradle with --no-daemon flag in CI scripts to avoid daemon lifecycle issues altogether: ./gradlew build --no-daemon",
      "success_rate": 0.9,
      "how": "Run Gradle with --no-daemon flag in CI scripts to avoid daemon lifecycle issues altogether: ./gradlew build --no-daemon",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Set org.gradle.daemon.idletimeout=7200000 in gradle.properties to increase idle timeout to 2 hours (value in milliseconds). Also set org.gradle.daemon.registrybase=/tmp/gradle-daemon to avoid PID file conflicts in CI.",
    "Run Gradle with --no-daemon flag in CI scripts to avoid daemon lifecycle issues altogether: ./gradlew build --no-daemon"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.gradle.org/current/userguide/gradle_daemon.html",
  "official_doc_section": null,
  "error_code": "DAEMON_EXPIRATION",
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-11-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}