]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-154366: Fix test_asyncio.test_sendfile timing out on DragonFly BSD (GH-154367)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 21 Jul 2026 15:03:20 +0000 (18:03 +0300)
committerGitHub <noreply@github.com>
Tue, 21 Jul 2026 15:03:20 +0000 (15:03 +0000)
A 4 KiB receive buffer makes DragonFly defer every window update to the
delayed ACK timer, so each buffer worth of data costs 100 ms.  Use a
larger socket buffer there; it is still small enough to pause the
protocol long before all data is sent.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Lib/test/test_asyncio/test_sendfile.py

index 69ac9a367f6be02d70bd6e05bdb909e337cf774e..c8d429c3d1651f05d75d8d7a3a5c575420cc7d4a 100644 (file)
@@ -98,7 +98,12 @@ class SendfileBase:
     # 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
+    if sys.platform.startswith('dragonfly'):
+        # A smaller buffer makes every window update wait 100 ms for the
+        # delayed ACK timer.
+        BUF_SIZE = 32 * 1024  # 32 KiB
+    else:
+        BUF_SIZE = 4 * 1024   # 4 KiB
 
     def create_event_loop(self):
         raise NotImplementedError