-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
ClientWebSocket heartbeat should throw exceptions #4153
Comments
So the solution is that upon exiting the |
let me meditate on it |
@asvetlov Any update on this? I came across the same problem as @alandtse, however the solution they provided does not properly address the real problem, as one will only exit the for loop if the connection comes UP again (otherwise it will just hang), which again defies the whole point of having a heartbeat. |
I have a fix for this issue that works correctly with aiohttp3.6.2 and Python 3.8.5, however aiottp 4.0.0a1 introduces another bug: #4526 that supersedes my fix. Are you still maintaining the stable version or only working on 4.0.*? |
aiohttp 3.7 is prepared to release; aiohttp 4.0 will probably have reimplemented heartbeats |
Where'd we end up here? |
Have the same issue: heartbeat is on, underlying TCP-connection appeared blocked, _pong_not_received is called but main code still awaits for messages from web-socket |
@alandtse seems your explanation is not correct. you said:
but actually, reading will not be stopped. |
Same issue met here. This is pretty critical as the server maintains resources after the client has vanished, and the heartbeat does not raise an exception about that. |
Its partially fixed. #8685 should fix the rest of the cases |
Long story short
A client websocket session with a heartbeat enabled will never indicate the connection is closed if a program is only receiving information.
This may be related to #2309 (which was server-side, but others appear to be commenting about client-side), where @asvetlov stated:
My understanding is the heartbeat is intended to create the ping message to detect the disconnection. Therefore, when someone is using the heartbeat, an exception should be raised when pong not received.
Expected behaviour
The Timeout exception should be raised upon detecting that
_pong_not_received
for calling programs to catch.Actual behaviour
The connection closes silently. The only way to detect it would be to add additional logic to send a ping, which is the purpose of the heartbeat.
Steps to reproduce
Your environment
Client
OS isn't relevant
The text was updated successfully, but these errors were encountered: