{
  "id": "aws/ecs-task-stopped-oom-kill",
  "signature": "Stopped reason: Task stopped due to OOM (Out of Memory) kill",
  "signature_zh": "停止原因：任务因内存不足 (OOM) 被终止",
  "regex": "Stopped reason: Task stopped due to OOM \\(Out of Memory\\) kill",
  "domain": "aws",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "The ECS task's memory allocation was exceeded, causing the Linux kernel OOM killer to terminate the container.",
  "root_cause_type": "generic",
  "root_cause_zh": "ECS 任务的内存分配被超出，导致 Linux 内核 OOM killer 终止了容器。",
  "versions": [
    {
      "version": "AWS CLI 2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ECS API 2014-11-13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Amazon ECS Agent 1.66.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Increasing memory hard limit without adjusting soft limit or task memory reservation can still cause OOM if the container exceeds the hard limit.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Rebuilding the container with a different base image without monitoring memory usage doesn't address the root cause of memory leak or high consumption.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the task memory hard limit in the ECS task definition, e.g., set 'memory' to 2048 MiB, and ensure 'memoryReservation' is at least 512 MiB. Then redeploy the service.",
      "success_rate": 0.8,
      "how": "Increase the task memory hard limit in the ECS task definition, e.g., set 'memory' to 2048 MiB, and ensure 'memoryReservation' is at least 512 MiB. Then redeploy the service.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add memory usage monitoring via CloudWatch Container Insights: enable in ECS cluster settings, then set up a CloudWatch alarm on 'MemoryUtilized' metric. If usage spikes, consider optimizing application code to reduce memory footprint.",
      "success_rate": 0.85,
      "how": "Add memory usage monitoring via CloudWatch Container Insights: enable in ECS cluster settings, then set up a CloudWatch alarm on 'MemoryUtilized' metric. If usage spikes, consider optimizing application code to reduce memory footprint.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 ECS 任务定义中增加任务内存硬限制，例如将 'memory' 设置为 2048 MiB，并确保 'memoryReservation' 至少为 512 MiB，然后重新部署服务。",
    "通过 CloudWatch Container Insights 添加内存使用监控：在 ECS 集群设置中启用，然后设置 CloudWatch 告警监控 'MemoryUtilized' 指标。如果使用量飙升，考虑优化应用程序代码以减少内存占用。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-stopped-reason.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.78,
  "resolvable": "true",
  "first_seen": "2023-06-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}