{
  "id": "cicd/jenkins-maven-compile-out-of-memory",
  "signature": "java.lang.OutOfMemoryError: Java heap space",
  "signature_zh": "java.lang.OutOfMemoryError：Java 堆空间",
  "regex": "java\\.lang\\.OutOfMemoryError: Java heap space",
  "domain": "cicd",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "Maven build in Jenkins exhausted the Java heap space, typically due to insufficient memory allocation for the JVM or a memory leak in the build plugins.",
  "root_cause_type": "generic",
  "root_cause_zh": "Jenkins 中的 Maven 构建耗尽了 Java 堆空间，通常是由于 JVM 内存分配不足或构建插件中存在内存泄漏。",
  "versions": [
    {
      "version": "Jenkins 2.440",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Maven 3.9.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OpenJDK 17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The Maven build runs as a separate process on the agent, not on the master; increasing master heap does not affect the build agent's JVM.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling necessary plugins breaks the build; memory issues are usually due to the compiler or surefire plugin handling large codebases, not plugin count.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase Maven's JVM heap via MAVEN_OPTS: `export MAVEN_OPTS=\"-Xmx2g -Xms512m\"` before the build step, or configure in Jenkins pipeline: `withEnv(['MAVEN_OPTS=-Xmx2g']) { sh 'mvn clean install' }`.",
      "success_rate": 0.85,
      "how": "Increase Maven's JVM heap via MAVEN_OPTS: `export MAVEN_OPTS=\"-Xmx2g -Xms512m\"` before the build step, or configure in Jenkins pipeline: `withEnv(['MAVEN_OPTS=-Xmx2g']) { sh 'mvn clean install' }`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add `<forkCount>1</forkCount>` and `<argLine>-Xmx1g</argLine>` to the Maven Surefire plugin configuration in pom.xml to limit test forking memory.",
      "success_rate": 0.8,
      "how": "Add `<forkCount>1</forkCount>` and `<argLine>-Xmx1g</argLine>` to the Maven Surefire plugin configuration in pom.xml to limit test forking memory.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Increase Maven's JVM heap via MAVEN_OPTS: `export MAVEN_OPTS=\"-Xmx2g -Xms512m\"` before the build step, or configure in Jenkins pipeline: `withEnv(['MAVEN_OPTS=-Xmx2g']) { sh 'mvn clean install' }`.",
    "Add `<forkCount>1</forkCount>` and `<argLine>-Xmx1g</argLine>` to the Maven Surefire plugin configuration in pom.xml to limit test forking memory."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://maven.apache.org/configure.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}