{
  "id": "cloud/azure-app-service-linux-container-crash-loop",
  "signature": "CrashLoopBackOff: Container 'myapp' in App Service 'myapp-linux' is repeatedly crashing. Error: 'Container exited with code 139 (Segmentation fault)'",
  "signature_zh": "CrashLoopBackOff：应用服务 'myapp-linux' 中的容器 'myapp' 反复崩溃。错误：'容器以代码 139 退出（段错误）'",
  "regex": "CrashLoopBackOff.*Container.*exited with code 139.*Segmentation fault",
  "domain": "cloud",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The container image has a segmentation fault, often due to incompatible base image (e.g., Alpine with glibc-dependent binaries) or memory corruption in the application.",
  "root_cause_type": "generic",
  "root_cause_zh": "容器镜像出现段错误，通常是由于基础镜像不兼容（例如，使用 Alpine 但应用程序依赖 glibc）或应用程序内存损坏。",
  "versions": [
    {
      "version": "azure_cli",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "app_service_linux",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "docker",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The crash is due to a segfault, not resource exhaustion; more resources won't fix the code bug.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Restarting doesn't change the container image; the same segfault will occur again.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Switch the Docker base image from Alpine to a glibc-based image like Debian or Ubuntu. For example, change `FROM python:3.11-alpine` to `FROM python:3.11-slim-bookworm` in your Dockerfile, rebuild, and redeploy.",
      "success_rate": 0.85,
      "how": "Switch the Docker base image from Alpine to a glibc-based image like Debian or Ubuntu. For example, change `FROM python:3.11-alpine` to `FROM python:3.11-slim-bookworm` in your Dockerfile, rebuild, and redeploy.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Enable diagnostic logs: `az webapp log config --name myapp-linux --resource-group myrg --docker-container-logging filesystem` then check logs at `/home/LogFiles/docker/` for more details on the segfault. Fix the application code (e.g., null pointer dereference) and rebuild the image.",
      "success_rate": 0.9,
      "how": "Enable diagnostic logs: `az webapp log config --name myapp-linux --resource-group myrg --docker-container-logging filesystem` then check logs at `/home/LogFiles/docker/` for more details on the segfault. Fix the application code (e.g., null pointer dereference) and rebuild the image.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Switch the Docker base image from Alpine to a glibc-based image like Debian or Ubuntu. For example, change `FROM python:3.11-alpine` to `FROM python:3.11-slim-bookworm` in your Dockerfile, rebuild, and redeploy.",
    "Enable diagnostic logs: `az webapp log config --name myapp-linux --resource-group myrg --docker-container-logging filesystem` then check logs at `/home/LogFiles/docker/` for more details on the segfault. Fix the application code (e.g., null pointer dereference) and rebuild the image."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux",
  "official_doc_section": null,
  "error_code": "139",
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.78,
  "resolvable": "partial",
  "first_seen": "2024-05-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}