queue websocket disconnect for dropped connections
Using uvicorn with wsproto implementation, if clients do not close websocket connections properly, no exc will be sent to connection_lost (see code below).
As in the current version of uvicorn, this creates two issues:
- apps will not receive
websocket.disconnectevents; - a zombie
run_asgi(asyncio) task running for each non properly closed connection;
In order to reproduce the issue, follow instructions on this repo: https://github.com/sephioh/uvicorn-wsproto-issue
seems like the exception check was added in https://github.com/encode/uvicorn/commit/3cab13283c849037e67b2c3afd64c57da3757f2c#diff-5f163724db1eaba811cc5e4ed55e529af488e351ee52ccfb7c1ad0329a8f0d92R65-R66 and I dont get the rationale given the context, I know it's been a while but do you remember why @almarklein or @tomchristie ?
Fixes https://github.com/encode/uvicorn/issues/997
Thank you for the PR @sephioh !
Also, sorry for the long waiting time.