Gunicorn工人以信号9终止
我正在运行一个 Flask 应用程序,并将它从 Docker 容器托管在 Kubernetes 上。Gunicorn 正在管理回复 API 请求的工作人员。
以下警告消息是经常发生的,似乎由于某种原因请求被取消。在 Kubernetes 上,pod 没有表现出任何奇怪的行为或重新启动并保持在其内存和 CPU 限制的 80% 以内。
[2021-03-31 16:30:31 +0200] [1] [WARNING] Worker with pid 26 was terminated due to signal 9
我们如何才能找出这些工人被杀害的原因?
回答
I encountered the same warning message.
[WARNING] Worker with pid 71 was terminated due to signal 9
I came across this faq, which says that "A common cause of SIGKILL is when OOM killer terminates a process due to low memory condition."
I used dmesg realized that indeed it was killed because it was running out of memory.
Out of memory: Killed process 776660 (gunicorn)