Gunicorn与gevent工作服务器在一段时间后挂起

时间:2014-02-13 09:07:30

标签: python sockets nginx gunicorn gevent

我在服务器运行一段时间后得到这个堆栈跟踪 2014-02-12 23:42:14 [28012] [错误]错误处理请求

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/gunicorn/workers/async.py", line 39, in handle
    self.handle_request(req, client, addr)
  File "/usr/lib/pymodules/python2.7/gunicorn/workers/ggevent.py", line 86, in handle_request
    super(GeventWorker, self).handle_request(*args)
  File "/usr/lib/pymodules/python2.7/gunicorn/workers/async.py", line 74, in handle_request
    resp.write(item)
  File "/usr/lib/pymodules/python2.7/gunicorn/http/wsgi.py", line 255, in write
    self.send_headers()
  File "/usr/lib/pymodules/python2.7/gunicorn/http/wsgi.py", line 251, in send_headers
    util.write(self.sock, "%s\r\n" % "".join(tosend))
  File "/usr/lib/pymodules/python2.7/gunicorn/util.py", line 235, in write
    sock.sendall(data)
  File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line 509, in sendall
    data_sent += self.send(_get_memory(data, data_sent), flags)
  File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line 483, in send
    return sock.send(data, flags)
error: [Errno 32] Broken pipe

我使用gunicorn + nginx作为服务器。这是我的枪支配置:

workers = 5
worker_class = 'egg:gunicorn#gevent'
worker_connections = 1000
timeout = 3600
keepalive = 2

我甚至不确定此堆栈跟踪是否是服务器挂起的实际原因,因为此堆栈跟踪后显示2-3个其他get请求(获取在服务器刚启动时正常工作的请求)并且不再生成日志。

也有一段时间后我不断收到错误“包含urlconf其中没有任何模式”。服务器刚启动时不会发生这种情况。我已经单独测试了所有网址,它们似乎工作正常。

任何帮助都将不胜感激。

0 个答案:

没有答案