{
  "id": "cloud/gcp-cloud-run-container-crash-oom",
  "signature": "Container terminated: Exit code 137 (Out of Memory)",
  "signature_zh": "容器终止：退出代码 137（内存不足）",
  "regex": "Exit code 137|Out of Memory|OOMKilled",
  "domain": "cloud",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "Cloud Run container exceeds its allocated memory limit (default 512 MB), causing the kernel OOM killer to terminate the process.",
  "root_cause_type": "generic",
  "root_cause_zh": "Cloud Run 容器超过其分配的内存限制（默认 512 MB），导致内核 OOM 杀手终止进程。",
  "versions": [
    {
      "version": "Cloud Run (fully managed)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Cloud Run for Anthos",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gcloud CLI 460.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Memory leaks continue to grow unbounded; the container will eventually hit the new limit too, wasting money.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The same container image with the same memory limit will crash again under the same load.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the memory limit for the Cloud Run service: `gcloud run deploy <SERVICE> --memory=1Gi --region=us-central1`. Monitor memory usage via Cloud Monitoring and adjust accordingly. Also consider reducing concurrency: `gcloud run deploy <SERVICE> --concurrency=10` to limit simultaneous requests.",
      "success_rate": 0.85,
      "how": "Increase the memory limit for the Cloud Run service: `gcloud run deploy <SERVICE> --memory=1Gi --region=us-central1`. Monitor memory usage via Cloud Monitoring and adjust accordingly. Also consider reducing concurrency: `gcloud run deploy <SERVICE> --concurrency=10` to limit simultaneous requests.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Profile the application to find memory-heavy operations. For Node.js, use `--max-old-space-size` flag in the Dockerfile: `CMD [\"node\", \"--max-old-space-size=256\", \"app.js\"]`. For Python, use `gc.set_threshold()` to tune garbage collection.",
      "success_rate": 0.75,
      "how": "Profile the application to find memory-heavy operations. For Node.js, use `--max-old-space-size` flag in the Dockerfile: `CMD [\"node\", \"--max-old-space-size=256\", \"app.js\"]`. For Python, use `gc.set_threshold()` to tune garbage collection.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Increase the memory limit for the Cloud Run service: `gcloud run deploy <SERVICE> --memory=1Gi --region=us-central1`. Monitor memory usage via Cloud Monitoring and adjust accordingly. Also consider reducing concurrency: `gcloud run deploy <SERVICE> --concurrency=10` to limit simultaneous requests.",
    "Profile the application to find memory-heavy operations. For Node.js, use `--max-old-space-size` flag in the Dockerfile: `CMD [\"node\", \"--max-old-space-size=256\", \"app.js\"]`. For Python, use `gc.set_threshold()` to tune garbage collection."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cloud.google.com/run/docs/troubleshooting#container-crash-oom",
  "official_doc_section": null,
  "error_code": "137",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.82,
  "resolvable": "partial",
  "first_seen": "2023-09-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}