139 cloud runtime_error ai_generated partial

CrashLoopBackOff:应用服务 'myapp-linux' 中的容器 'myapp' 反复崩溃。错误:'容器以代码 139 退出(段错误)'

CrashLoopBackOff: Container 'myapp' in App Service 'myapp-linux' is repeatedly crashing. Error: 'Container exited with code 139 (Segmentation fault)'

ID: cloud/azure-app-service-linux-container-crash-loop

其他格式: JSON · Markdown 中文 · English
78%修复率
82%置信度
1证据数
2024-05-20首次发现

版本兼容性

版本状态引入弃用备注
azure_cli active
app_service_linux active
docker active

根因分析

容器镜像出现段错误,通常是由于基础镜像不兼容(例如,使用 Alpine 但应用程序依赖 glibc)或应用程序内存损坏。

English

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.

generic

官方文档

https://learn.microsoft.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux

解决方案

  1. 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.
  2. 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.

无效尝试

常见但无效的做法:

  1. 90% 失败

    The crash is due to a segfault, not resource exhaustion; more resources won't fix the code bug.

  2. 95% 失败

    Restarting doesn't change the container image; the same segfault will occur again.