abersheeran / a2wsgi

Convert WSGI app to ASGI app or ASGI app to WSGI app.
Apache License 2.0
226 stars 20 forks source link

Uvicorn 0.28.0 introduction of new ClientDisconnected exception which impacts WSGIMiddleware on client disconnects #49

Closed kravnaut closed 7 months ago

kravnaut commented 7 months ago

We have a few endpoints behind the WSGIMiddleware. We noticed that with uvicorn upgrade to 0.28.0 it introduced a new ClientDisconnected exception that is now getting into the flow. It seems that WSGIMiddleware is not catching it / handling it and the request appears as if it never completed as our outer ASGI middleware is observing.

Repro is to have a flask app behind WSGIMiddleware to do something slow and then make a request and cancel it before the flask endpoint can return a response. We can then observe that the middleware app awaitable is never completing, resources keep piling up.

kravnaut commented 7 months ago

ah, should have looked at closed issues, seems like 1.10.2 -> 1.10.4 should fix this for us