小编Tri*_*mth的帖子

使用gevent.queue.Queue.get():gevent.hub.LoopExit:'此操作将永远阻止'

过去几天我一直在尝试将事件流整合到我的烧瓶应用程序中,并在我的本地测试中取得了良好的效果,但在我的服务器上使用uWSGI运行应用程序时更糟糕一些.我的代码基本上建立在flask 的例子之上.我正在使用python 3.4.2.

问题

在我的uWSGI服务器上运行应用程序时,gevent.hub.LoopExit: 'This operation would block forever'.只要客户端尝试连接到/streaming端点,就会引发该应用程序.我的假设是这是由get()无限期地调用空队列引起的.

完全追溯:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/werkzeug/wsgi.py", line 691, in __next__
    return self._next()
  File "/usr/lib/python3/dist-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
    for item in iterable:
  File "./voting/__init__.py", line 49, in gen
    result = queue.get(block=True)
  File "/usr/local/lib/python3.4/dist-packages/gevent/queue.py", line 284, in get
    return self.__get_or_peek(self._get, block, timeout)
  File "/usr/local/lib/python3.4/dist-packages/gevent/queue.py", line 261, in __get_or_peek
    result = waiter.get()
  File "/usr/local/lib/python3.4/dist-packages/gevent/hub.py", line 878, in get
    return self.hub.switch() …
Run Code Online (Sandbox Code Playgroud)

python multithreading gevent flask uwsgi

2
推荐指数
1
解决办法
963
查看次数

标签 统计

flask ×1

gevent ×1

multithreading ×1

python ×1

uwsgi ×1