-
-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'WebSocketProtocol' object has no attribute 'transfer_data_task' #1396
Comments
Thank you for your report. It shouldn't be possible to reach this line in Could you provide a bit more details, please?
|
+1 here:
The issue occured while doing some evil concurrent load/abort/reload clicking of a Javascript/Vue.js-based page connecting to my websocket using the vueuse |
This has to do with how uvicorn embeds websockets. It was integrated before I provided a good API for that use case — namely the Sans-I/O implementation. It's done by using private APIs and it doesn't respect perfectly the logic & invariants that websockets relies on. This is hard and not very valuable to fix. Now the good API for embedding exists and it should be adopted in uvicorn: encode/uvicorn#1908 That's the proper fix really. |
PS: I don't know if that's the explanation of the first report; I never got details on that one. It's the explanation of the second report, where I have a stack trace. |
When the client disconnects just after setting
self.application_state = WebSocketState.CONNECTED
, subsequentws.close()
will fail at.venv/lib/python3.11/site-packages/websockets/legacy/protocol.py:784
astransfer_data_task
will not be set up.I suppose it should be guarded by
if hasattr(self, "transfer_data_task"):
as it is in other places.The text was updated successfully, but these errors were encountered: