-
-
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
Discard non-close messages in close timeout window #9508
base: master
Are you sure you want to change the base?
Discard non-close messages in close timeout window #9508
Conversation
for more information, see https://pre-commit.ci
Breaks this test: aiohttp/tests/test_web_websocket_functional.py Lines 1235 to 1254 in 9e975d2
IMO the test is broken, or at least names and comments are misleading. I'm a bit perplexed why this test even passed before. Note that the test tests for the close code of the I'm not entirely sure what this test intends to test, or even if it intends to test server or client side behavior. |
The intent of the test is to verify the client gets an ABNORMAL_CLOSURE when sever initiated close while it was trying to send a |
I think this is questionable. The server closed the connection cleanly, even if the client tried to send a message. There could be connection schemes where the client sends fire-and-forget status updates, and the server could close the connection whenever. The client should get the close code sent from the server, not abnormal closure in this case. Having said that I struggle to find normative wording in the RFC that would describe the conforming behavior in this situation. The best I can find is (under "Normal Closure of Connections"): https://datatracker.ietf.org/doc/html/rfc6455#section-7.3
And for 1006:
The "e.g." doesn't help here, suggesting that there are other situations where this is applicable. Anyway, I think there are some problems with the autoclose mechanism of the client, and I can make a similar test fail to have the expected result, even when the client doesn't try to send a message that the server doesn't expect. |
Your changes seems reasonable to me. We likely need to adjust the test. I agree the RFC is not crystal clear. We also need a test for the new behavior as well |
In any case, there is probably a missing test that checks for the server side behavior. This particular test can be made to pass with |
I think thats fine, but please add a comment to explain the 0 timeout. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9508 +/- ##
==========================================
- Coverage 98.58% 98.58% -0.01%
==========================================
Files 107 105 -2
Lines 35012 35118 +106
Branches 4146 4182 +36
==========================================
+ Hits 34517 34620 +103
- Misses 330 332 +2
- Partials 165 166 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
What do these changes do?
Waits for a close message in the close timeout window, not just the first message.
Are there changes in behavior for the user?
Previously spurious abnormally closed websocket connections could be reported to the server, even if the client responded to the close message with a close in a timely manner.
Is it a substantial burden for the maintainers to support this?
No
Related issue number
#9506
Checklist
Documentation reflects the changesCONTRIBUTORS.txt
CHANGES/
folder