Gunicorn: 当 --max-requests-jitter 设置为非零值时,工作人员以 --max-requests=0 重新启动

创建于 2019-02-05  ·  4评论  ·  资料来源: benoitc/gunicorn

要重现,请像这样启动 gunicorn:

gunicorn -w 1 --max-requests=0 --max-requests-jitter=10 -b 0.0.0.0:8000 api:app

然后将一些流量定向到它并观察以下日志输出:

[2019-02-05 20:27:23 +0000] [19] [INFO] Starting gunicorn 19.9.0
[2019-02-05 20:27:23 +0000] [19] [INFO] Listening at: http://0.0.0.0:8000 (19)
[2019-02-05 20:27:23 +0000] [19] [INFO] Using worker: sync
[2019-02-05 20:27:23 +0000] [22] [INFO] Booting worker with pid: 22
[2019-02-05 20:27:37 +0000] [22] [INFO] Autorestarting worker after current request.
[2019-02-05 20:27:37 +0000] [22] [INFO] Worker exiting (pid: 22)
[2019-02-05 20:27:37 +0000] [24] [INFO] Booting worker with pid: 24

我希望当--max-requests设置为 0 时--max-requests-jitter不起作用。

( Feedback Requested )

最有用的评论

此错误已在 d4e1bfe5bd7801c160282310875c70cec15b7c07 中引入:

self.max_requests = cfg.max_requests + jitter or MAXSIZE现在self.max_requests = cfg.max_requests + jitter or sys.maxsize自 e974f30517261b2bc95cfb2017a8688f367c8bf3 将设置self.max_requests为 _jitter_ 值。

只有当它的设置值大于0时,我们才应该真正设置self.max_requests

所有4条评论

您期望的行为是什么? 通常, max-requests=0应该意味着工作人员永远不会自动重启,但从您的日志中它看起来好像确实如此。

此错误已在 d4e1bfe5bd7801c160282310875c70cec15b7c07 中引入:

self.max_requests = cfg.max_requests + jitter or MAXSIZE现在self.max_requests = cfg.max_requests + jitter or sys.maxsize自 e974f30517261b2bc95cfb2017a8688f367c8bf3 将设置self.max_requests为 _jitter_ 值。

只有当它的设置值大于0时,我们才应该真正设置self.max_requests

@joekohlsdorf上面的补丁应该可以修复错误,但请告诉我们...

谢谢,我觉得不错。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

lordmauve picture lordmauve  ·  3评论

benoitc picture benoitc  ·  4评论

Abraxos picture Abraxos  ·  4评论

Bogdanp picture Bogdanp  ·  3评论

zenglingyu picture zenglingyu  ·  4评论