Error trying to disconnect #717
Replies: 4 comments
-
I think there is a race condition here, where the client is in the process of closing down and yet the server has sent an event. I will try to reproduce this. |
Beta Was this translation helpful? Give feedback.
-
I'm seeing a similar issue ("Cannot write to closing transport" exception when explicitly calling disconnect on an async client) using python-socket 4.6.0/python-engineio 3.13.2 with the latest aiohttp (3.7.3). I do not observe this with an earlier aiohttp (3.6.2). Looking at the aiohttp release notes (https://docs.aiohttp.org/en/stable/changes.html#id32), it looks to be related to this change: aio-libs/aiohttp#4080. Should the disconnect function be changed to either handle this exception, or somehow cancel the underlying aiohttp web handler task to restore the previous behaviour? Any pointers on the best way to work around this would be appreciated.Thanks! |
Beta Was this translation helpful? Give feedback.
-
I solved this by upgrading to the latest 4.x version of python-socketio and the latest 3.x version of python-engineio (4.6.1 and 3.14.2 respectively), so please disregard. |
Beta Was this translation helpful? Give feedback.
-
@numbereself with the 4.6.1 release of python-socketio I do not get the error, but I do see the missing disconnect handler. Unfortunately the server that you are using has not been upgraded to the latest version of Socket.IO protocol, so I cannot test with the most current version of this package. |
Beta Was this translation helpful? Give feedback.
-
When i try calling the async disconnect function as a result of a packet i get an error stating "Cannot write to closing transport"
Here is the code I used:
And here is the ouput:
I am not exactly sure what this server in particular is running, but I am asuming it is NodeJS.
Also I feel like a disconnect event should fire regardless of the reason. No event fires however.
I was expecting to see the disconnect event fire at least. Also not seeing an exception is preferable.
Or is there an issue about using sleep here?
Beta Was this translation helpful? Give feedback.
All reactions