Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',) Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',) flask flask

Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',)


I ran into this problem a while back and it was caused by not monkey-patching the threading module correctly.

At the top of your app, apply the gevent patches:

from gevent import monkey, sleepmonkey.patch_all()


you should avoid using time.sleep() with gevent .You should use gevent.sleep() instead.time.sleep() will block the gevent loop


From https://github.com/gevent/gevent/issues/585#issuecomment-122406552

Ensure that your GEvent Pool size is more than 1. If it is set to 1, GEvent will not have any workers to switch to when processing events and will thus complain about it.