]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 28 Aug 2024 12:47:41 +0000 (14:47 +0200)
committerGitHub <noreply@github.com>
Wed, 28 Aug 2024 12:47:41 +0000 (12:47 +0000)
gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux >= 6.10 (GH-120227)

The worst case is that the kernel buffers 17 pages with a page size of 64k.
(cherry picked from commit a7584245661102a5768c643fbd7db8395fd3c90e)

Co-authored-by: Xi Ruoyao <xry111@xry111.site>
Lib/test/test_asyncio/test_sendfile.py

index d33ff197bbfa1de9988a3d1eb3d2dc205cf33295..2509d4382cdebd7f5e7146caec2838342a15a90d 100644 (file)
@@ -93,13 +93,10 @@ class MyProto(asyncio.Protocol):
 
 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