首页 > 解决方案 > Gunicorn:检查正在运行的进程的命令行参数。(高山 Linux)

问题描述

我有一个奇怪的情况。使用任务定义中的命令在 AWS ECS (EC2) 上运行 gunicorn

      "command": [
        "/usr/local/bin/gunicorn",
        "--bind",
        "0.0.0.0:8000",
        "--timeout",
        "60",
        "admin.wsgi"
      ],

timeout 参数是最近添加的,我想检查 gunicorn 是否正确应用了它。

现在,如果我这样做

$ gunicorn --print-config admin.wsgi | grep timeout
graceful_timeout                  = 30
timeout                           = 30

它似乎没有被应用,好吧,gunicorn docs(https://docs.gunicorn.org/en/stable/configure.html)不是很清楚,所以可能--print-config只是打印来自外部配置文件的东西和环境变量。

所以现在我正在尝试从 Alpine linux 访问 cmdline 参数:

~ $ cat /proc/1/cmdline ; echo
gunicorn: master [admin.wsgi]
~ $ cat /proc/7/cmdline ; echo
gunicorn: worker [admin.wsgi]

但这也不是很有帮助:(

最后一枪,gunicorn 启动日志:

2021-10-08 13:41:25[2021-10-08 20:41:25 +0000] [1] [INFO] Starting gunicorn 20.1.0
2021-10-08 13:41:25[2021-10-08 20:41:25 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
2021-10-08 13:41:25[2021-10-08 20:41:25 +0000] [1] [INFO] Using worker: sync
2021-10-08 13:41:25[2021-10-08 20:41:25 +0000] [7] [INFO] Booting worker with pid: 7

更多的悲伤。

有什么方法可以查看 gunicorn 进程的当前超时时间(除了篡改代码并让工作人员睡眠 30 多秒以查看它是否是 SIGABRT)?

标签: processtimeoutcommand-line-argumentsgunicornalpine

解决方案


推荐阅读