有时(几小时一次)gunicorn worker因以下错误而失败:
[2014-10-29 10:21:54 +0000] [4902] [INFO] Booting worker with pid: 4902
[2014-10-29 13:15:24 +0000] [4902] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/opt/test/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/opt/test/env/local/lib/python2.7/site-packages/gunicorn/workers/gthread.py", line 109, in init_process
super(ThreadWorker, self).init_process()
File "/opt/test/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 120, in init_process
self.run()
File "/opt/test/env/local/lib/python2.7/site-packages/gunicorn/workers/gthread.py", line 177, in run
self.murder_keepalived()
File "/opt/test/env/local/lib/python2.7/site-packages/gunicorn/workers/gthread.py", line 149, in murder_keepalived
self.poller.unregister(conn.sock)
File "/opt/test/env/local/lib/python2.7/site-packages/trollius/selectors.py", line 408, in unregister
key = super(EpollSelector, self).unregister(fileobj)
File "/opt/test/env/local/lib/python2.7/site-packages/trollius/selectors.py", line 243, in unregister
raise KeyError("{0!r} is not registered".format(fileobj))
KeyError: '<socket._socketobject object at 0x7f823f454d70> is not registered'
...
...
[2014-10-29 13:15:24 +0000] [4902] [INFO] Worker exiting (pid: 4902)
[2014-10-29 13:15:24 +0000] [5809] [INFO] Booting worker with pid: 5809
...
配置:
^{pr2}$我用的是:
Python 2.7.6
gunicorn==19.1.1
trollius==1.0.2
futures==2.2.0
有什么想法吗?原因是什么?怎么解决?在
谢谢!在
我也遇到了类似的问题,我从gunicorn worker那里得到了超时错误。我正在使用sync worker并且有}的默认设置。
在我的用例中,我的http请求需要很长时间才能完成,因此sync worker超时了。我使用
timeout
和{curl
作为发送http-1.1请求的http客户端。我把超时时间增加到了一个疯狂的高值3600
,这是1小时,这是有效的。不过,在服务器错误日志中,我看到了与您相同的错误。这是我关于这个错误的假设。 因为默认情况下,所有http1.1请求都是持久的,所以服务器会尝试重用连接,方法是将连接放回队列中,但不会超过keepalive
超时。所以当keepalive
超时发生时,它会注销套接字,这样就不能重用它,并关闭它。现在,由于我的超时值非常高,服务器多次尝试注销一个已经注销的套接字,但是keepalive仍然默认为5秒,所以错误就出来了。因此,我增加了“keepalivevalue as well to
3600````。到目前为止还有效。在我在大约一年前报告了一个gunicorn错误,修复应该在gunicorn 19.6.0及更高版本中:https://github.com/benoitc/gunicorn/issues/1258
相关问题 更多 >
编程相关推荐