获取'gevent.hub.LoopExit:此操作将永远阻止',同时结合python3.4,flask和gevent

时间:2015-05-07 18:55:15

标签: python-3.x flask gevent

我在项目中导入gevent后出现此错误。我不需要实际调用触摸任何gevent代码并在每次通过Flask API进行调用时自动获取此错误。有任何想法吗?

我使用了这个版本的gevent:

pip install git+git://github.com/ddxd/gevent.git

这是错误消息:

Traceback (most recent call last):
File "/home/qa/anaconda3/lib/python3.4/socketserver.py", line 617, in process_request_thread
self.finish_request(request, client_address)
File "/home/qa/anaconda3/lib/python3.4/socketserver.py", line 344, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/qa/anaconda3/lib/python3.4/socketserver.py", line 673, in __init__
self.handle()
File "/home/qa/anaconda3/lib/python3.4/site-packages/werkzeug/serving.py", line 203, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "/home/qa/anaconda3/lib/python3.4/http/server.py", line 398, in handle
self.handle_one_request()
File "/home/qa/anaconda3/lib/python3.4/site-packages/werkzeug/serving.py", line 234, in handle_one_request
self.raw_requestline = self.rfile.readline()
File "/home/qa/anaconda3/lib/python3.4/socket.py", line 374, in readinto
return self._sock.recv_into(b)
File "/home/qa/anaconda3/lib/python3.4/site-packages/gevent/_socket3.py", line 282, in recv_into
self._wait(self._read_event)
File "/home/qa/anaconda3/lib/python3.4/site-packages/gevent/_socket3.py", line 97, in _wait
self.hub.wait(watcher)
File "/home/qa/anaconda3/lib/python3.4/site-packages/gevent/hub.py", line 359, in wait
result = waiter.get()
File "/home/qa/anaconda3/lib/python3.4/site-packages/gevent/hub.py", line 586, in get
return self.hub.switch()
File "/home/qa/anaconda3/lib/python3.4/site-packages/gevent/hub.py", line 349, in switch
return greenlet.switch(self)
gevent.hub.LoopExit: This operation would block forever

1 个答案:

答案 0 :(得分:0)

我禁用了调试模式并修复了问题。不知道为什么会发生这种情况。 这篇文章似乎是相关的。

https://github.com/miguelgrinberg/Flask-SocketIO/issues/66