8000 [3.9] bpo-41682: fixed flaky test test_sendfile_close_peer_in_the_middle_of_receiving (GH-30845) by miss-islington · Pull Request #30861 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.9] bpo-41682: fixed flaky test test_sendfile_close_peer_in_the_middle_of_receiving (GH-30845) #30861

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

Merged
merged 1 commit into from
Jan 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Lib/test/test_asyncio/test_sendfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ async def wait_closed(self):

class SendfileBase:

# 128 KiB plus small unaligned to buffer chunk
DATA = b"SendfileBaseData" * (1024 * 8 + 1)

# 256 KiB plus small unaligned to buffer chunk
# Newer versions of Windows seems to have increased its internal
# buffer and tries to send as much of the data as it can as it
# has some form of buffering for this which is less than 256KiB
# on newer server versions and Windows 11.
# So DATA should be larger than 256 KiB to make this test reliable.
DATA = b"x" * (1024 * 256 + 1)
Comment on lines -90 to +96
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep coming back to this. I don't think it's worth changing anything (too much churn), but I would still like to point out that the original code had 16 bytes at the end of the 128 kb; the new code has only one extra byte after the 256 kb.

Also, this change affects almost all tests in this file, rather than just the one flaky test.

Finally, the use of "SendfileBaseData" as the dummy data seemed to be intentional to help debugging the test (e.g. test_sock_sendfile_mix_with_regular_send).

Just making sure you were aware of all these. :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't read the original PR. I only helped to backport the change because IMO it's better to run a test than skipping it in 3.9 and 3.10 branch.

@kumaraditya303: Do you want to write a PR to make changes suggested by @gvanrossum?

# Reduce socket buffer size to test on relative small data sets.
BUF_SIZE = 4 * 1024 # 4 KiB

Expand Down Expand Up @@ -451,8 +455,6 @@ def test_sendfile_ssl_close_peer_after_receiving(self):
# themselves).
@unittest.skipIf(sys.platform.startswith('sunos'),
"Doesn't work on Solaris")
@unittest.skipIf(sys.platform == "win32",
"It is flaky on Windows and needs to be fixed") # TODO: bpo-41682
def test_sendfile_close_peer_in_the_middle_of_receiving(self):
srv_proto, cli_proto = self.prepare_sendfile(close_after=1024)
with self.assertRaises(ConnectionError):
Expand Down
0