-
-
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
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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #9508 +/- ##
=======================================
Coverage 98.66% 98.67%
=======================================
Files 116 116
Lines 35638 35676 +38
Branches 4225 4229 +4
=======================================
+ Hits 35164 35202 +38
Misses 319 319
Partials 155 155
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@lenard-mosys It looks like a conflict has appeared |
CodSpeed Performance ReportMerging #9508 will not alter performanceComparing Summary
|
Co-authored-by: J. Nick Koston <[email protected]>
@lenard-mosys We are likely doing another release soon. Not sure how keen you are to get this in the next one, but just in case you missed my comment above about the missing branch coverage for https://github.com/aio-libs/aiohttp/pull/9508/files#diff-37008174f47abcf385c9bd15d713b586a921dc6aad7d75acd1510aebc75d2b4fR503 |
I'm not in a hurry with this. I added a test that hopefully covers the previously missing branch. |
Thanks. I'll take a look as soon as I can. CI is a bit busy now as I'm cleaning up to prep another beta release |
Weird. I don't understand how the next line is covered then. My added test should cover the hidden |
I have some trouble covering the missing branch (that is producing a It looks like that |
It looks like the only place we could get one is from
|
For that to happen, close would have to be called right after |
But that will set |
So I agree its truly unreachable. |
Thanks @lenard-mosys ! |
Backport to 3.10: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 274c54e on top of patchback/backports/3.10/274c54e46c11e6f527326a3574eb984f90e0f740/pr-9508 Backporting merged PR #9508 into master
🤖 @patchback |
Backport to 3.11: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 274c54e on top of patchback/backports/3.11/274c54e46c11e6f527326a3574eb984f90e0f740/pr-9508 Backporting merged PR #9508 into master
🤖 @patchback |
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: J. Nick Koston <[email protected]> (cherry picked from commit 274c54e)
3.10 #9687 |
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: J. Nick Koston <[email protected]> (cherry picked from commit 274c54e)
3.11 #9688 |
… timeout window (#9688) Co-authored-by: pre-commit-ci[bot] Co-authored-by: J. Nick Koston <[email protected]> Co-authored-by: lenard-mosys <[email protected]>
… timeout window (#9687) Co-authored-by: pre-commit-ci[bot] Co-authored-by: J. Nick Koston <[email protected]> Co-authored-by: lenard-mosys <[email protected]>
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