douban / greenify

Make blocking C library work with gevent
BSD 3-Clause "New" or "Revised" License
430 stars 58 forks source link

AssertionError: Invalid switch into Greenlet #23

Open lironshurgi opened 2 years ago

lironshurgi commented 2 years ago

We got a few errors like that on prod - seems that the gevent switch failed. Among thousands of requests a few of them got the error below:

Traceback (most recent call last): File "greenify.pyx", line 71, in greenify.wait AssertionError: Invalid switch into <Greenlet at 0x7fd6ea869260: _handle_and_close_when_done(functools.partial(<bound method GeventWorker.handl, <bound method StreamServer.do_close of <StreamServ, (<gevent._socket3.socket at 0x7fd6eb29c9a0 object,)>: None Exception ignored in: 'greenify.wait_gevent' Traceback (most recent call last): File "greenify.pyx", line 71, in greenify.wait AssertionError: Invalid switch into <Greenlet at 0x7fd6ea869260: _handle_and_close_when_done(functools.partial(<bound method GeventWorker.handl, <bound method StreamServer.do_close of <StreamServ, (<gevent._socket3.socket at 0x7fd6eb29c9a0 object,)>: None

Python version: 3.9.10 Pyramid: 2.0 gevent: 21.12.0 gunicorn: 20.1.0 SQLAlchemy: 1.4.36