RuntimeError instead of ClientDisconnected when client quickly disconnects in websockets-sansio
#2891
Unanswered
MrNaif2018
asked this question in
Potential Issue
Replies: 1 comment
-
|
cc @Kludex |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When testing the new 0.44.0 release I accidentally found another bug.
Basically my websocket endpoint, inside
on_connectof starlette'sWebSocketEndpointruns some checks against db to verify if it's an existing object and I can start redis pub/sub for this websocket.And if a client opens a tab, the code runs validation, client closes the tab, then the code finishes validation, calls websocket.accept(), but uvicorn raises RuntimeError:
It fails here:
uvicorn/uvicorn/protocols/websockets/websockets_sansio_impl.py
Line 448 in edb54c4
Here's a minimal reproducer script:
Details
Claude suggests this fix:

But I'm not so sure about that
Beta Was this translation helpful? Give feedback.
All reactions