1

我的应用程序托管在 AWS 中。我有一个使用 gunicorn Web 服务器在 ECS 上运行的 python 应用程序,ECS 位于负载均衡器 (ALB) 后面。我面临的问题是,我经常从 ALB 收到 502 Gateway 错误。当我检查日志时,它在列的位置有 - (连字符)target_status_code

根据AWS doc,以下是该字段的描述,

target_status_code:目标响应的状态码。仅当与目标建立连接并且目标发送响应时,才会记录此值。否则,将其设置为 -。

但是当我检查目标组时,看起来没有任何连接问题。

我使用以下命令启动 gunicorn 工作者,

gunicorn \
-c gunicorn_config.py \
-b 0.0.0.0:5000 aiohttp_wsgi_handler:aioapp \
-k aiohttp.worker.GunicornWebWorker \
-w 3 \
--access-logfile - \
--access-logformat '%t [INFO] %P request_id=%{X-REQUEST-ID}o cf_id=%{X-Amz-Cf-Id}i %r %s %b %Tfs' \
--log-level debug \
--graceful-timeout 180

另外,我检查了应用程序日志,我提出的请求还没有到达应用程序。

这可能是什么原因?

4

0 回答 0