我使用Flask和Gunicorn使用" gevent"工人。请求完成,客户端收到响应,Gunicorn吐出"错误处理请求",然后等待新请求。
这是堆栈跟踪:
2014-07-12 18:01:53 [38427] [INFO] Booting worker with pid: 38427
2014-07-12 18:01:55 [38427] [DEBUG] POST /job/dev/job1
2014-07-12 18:01:55 [38427] [ERROR] Error handling request
Traceback (most recent call last):
File "/Users/dustin/development/python/mapreduce/lib/python2.7/site-packages/gunicorn/workers/async.py", line 116, in handle_request
raise StopIteration()
StopIteration
(我应该注意到这是" async"工作模块,而不是预期的" gevent"一个。)
这是该模块的相关部分:
except Exception:
if resp and resp.headers_sent:
# If the requests have already been sent, we should close the
# connection to indicate the error.
self.log.exception("Error handling request")
try:
sock.shutdown(socket.SHUT_RDWR)
sock.close()
except socket.error:
pass
raise StopIteration()
raise
finally:
有没有人有这方面的经验?我是Gunicorn的长期用户,但经常没有使用Flask。我猜测Flask正在做一些让早期发回标题的东西。