gunicorn开启gevent模式,启动服务的时候报超时错误,服务起不来

报错

 [[2022-08-25 08:26:45 +0000]] CRITICAL [glogging.py:255] WORKER TIMEOUT (pid:669)'

在这里插入图片描述

解决方案参考:

有可能是协程模型,worker_connections 的默认值过大,导致起不来,改成多线程,gthread模型,服务就可以起来。

https://github.com/benoitc/gunicorn/issues/2608
https://github.com/benoitc/gunicorn/issues/1840

It has been said many time to not ry to ru a pytorch or other blocking process in main worker processes (or in gevent). If you need to orun a blocking process, run it as a separate daemon and dialog with it using unix sockets . Asyncio will not change anything as well there.
So in short: start the process from a gunicorn request, and make your client polling the sytem from time to time or wait for it in an unblocking manner.

It has been said many time to not ry to ru a pytorch or other blocking process in main worker processes (or in gevent). If you need to orun a blocking process, run it as a separate daemon and dialog with it using unix sockets . Asyncio will not change anything as well there.

So in short: start the process from a gunicorn request, and make your client polling the sytem from time to time or wait for it in an unblocking manner.

已经说过很多次不要尝试在主工作进程(或 gevent)中运行 pytorch 或其他阻塞进程。 如果您需要运行阻塞进程,请将其作为单独的守护进程运行并使用 unix sockets 与之对话。 Asyncio 也不会在那里改变任何东西。

简而言之:从 gunicorn 请求开始该过程,并让您的客户端不时轮询系统或以畅通无阻的方式等待它。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值