{
  "id": "cicd/gradle-daemon-stopped-build-limit",
  "signature": "Gradle build daemon stopped unexpectedly. The daemon will be stopped at the end of the build after running out of memory.",
  "signature_zh": "Gradle 构建守护进程意外停止。守护进程将在构建结束后因内存不足而停止。",
  "regex": "Gradle build daemon stopped unexpectedly.*running out of memory",
  "domain": "cicd",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The Gradle daemon exceeded the configured maximum heap size, causing it to be killed by the JVM or the OS, typically due to insufficient memory allocation in CI runners.",
  "root_cause_type": "generic",
  "root_cause_zh": "Gradle 守护进程超过了配置的最大堆内存大小，导致被 JVM 或操作系统终止，通常是由于 CI 运行器中的内存分配不足。",
  "versions": [
    {
      "version": "Gradle 7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Gradle 8.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Gradle 8.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If the CI runner has a hard memory limit (e.g., 4 GB), the daemon may still be killed if total memory usage exceeds that limit.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This avoids the daemon but causes slower builds and may not resolve the underlying memory pressure if the build itself requires more memory.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set a lower maximum heap size and enable parallel garbage collection: add `org.gradle.jvmargs=-Xmx1024m -XX:+UseParallelGC` to gradle.properties",
      "success_rate": 0.75,
      "how": "Set a lower maximum heap size and enable parallel garbage collection: add `org.gradle.jvmargs=-Xmx1024m -XX:+UseParallelGC` to gradle.properties",
      "condition": "",
      "sources": []
    },
    {
      "action": "Reduce build parallelism by setting `org.gradle.workers.max=2` in gradle.properties, which limits concurrent tasks and memory usage.",
      "success_rate": 0.85,
      "how": "Reduce build parallelism by setting `org.gradle.workers.max=2` in gradle.properties, which limits concurrent tasks and memory usage.",
      "condition": "",
      "sources": []
    },
    {
      "action": "In CI, set the GRADLE_OPTS environment variable: `export GRADLE_OPTS=\"-Xmx512m -XX:+UseG1GC\"` before running the build",
      "success_rate": 0.8,
      "how": "In CI, set the GRADLE_OPTS environment variable: `export GRADLE_OPTS=\"-Xmx512m -XX:+UseG1GC\"` before running the build",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Set a lower maximum heap size and enable parallel garbage collection: add `org.gradle.jvmargs=-Xmx1024m -XX:+UseParallelGC` to gradle.properties",
    "Reduce build parallelism by setting `org.gradle.workers.max=2` in gradle.properties, which limits concurrent tasks and memory usage.",
    "In CI, set the GRADLE_OPTS environment variable: `export GRADLE_OPTS=\"-Xmx512m -XX:+UseG1GC\"` before running the build"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties",
  "official_doc_section": null,
  "error_code": "GRADLE_DAEMON_OOM",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2023-06-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}