Skip to content

Commit

Permalink
pythongh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiv…
Browse files Browse the repository at this point in the history
…ing on Linux >= 6.10 (python#120227)

The worst case is that the kernel buffers 17 pages with a page size of 64k.
  • Loading branch information
xry111 authored Jun 7, 2024
1 parent 10fb1b8 commit a758424
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Lib/test/test_asyncio/test_sendfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,10 @@ async def wait_closed(self):

class SendfileBase:

# 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)
# Linux >= 6.10 seems buffering up to 17 pages of data.
# So DATA should be large enough to make this test reliable even with a
# 64 KiB page configuration.
DATA = b"x" * (1024 * 17 * 64 + 1)
# Reduce socket buffer size to test on relative small data sets.
BUF_SIZE = 4 * 1024 # 4 KiB

Expand Down

0 comments on commit a758424

Please sign in to comment.