]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fixup! Port the long TCP stream test to Python stepan/tcp-system-test-python 11890/head
authorŠtěpán Balážik <stepan@isc.org>
Thu, 16 Jul 2026 20:08:51 +0000 (22:08 +0200)
committerŠtěpán Balážik <stepan@isc.org>
Fri, 17 Jul 2026 08:50:00 +0000 (10:50 +0200)
bin/tests/system/tcp/tests_tcp.py

index 6d80208ca9b45022e7dd97e43de90ed6da52a809..766ed66ca597e925c31a1e88dfbef7f3454bb3f5 100644 (file)
@@ -258,15 +258,25 @@ async def send_long_tcp_stream(
         reader, writer = await asyncio.open_connection(host, port)
         discard_task = asyncio.create_task(discard_stream(reader))
         try:
-            remaining = frames_remaining
-            while remaining > 0:
-                frames = min(chunk_frames, remaining)
-                writer.write(frame * frames)
+            # The server may close the connection before we have written the
+            # whole stream. This shows up notably on Alma Linux 8: under
+            # concurrent load its small default TCP buffers let the flow
+            # control between us and named wedge, named then hits its idle
+            # timeout and resets the connection mid-write, and drain() raises
+            # ConnectionResetError. That is fine -- the connection being torn
+            # down is acceptable and the only thing this test asserts is that
+            # named survives the flood, which the query below checks -- so
+            # tolerate the server closing the connection early.
+            with contextlib.suppress(ConnectionResetError):
+                remaining = frames_remaining
+                while remaining > 0:
+                    frames = min(chunk_frames, remaining)
+                    writer.write(frame * frames)
+                    await writer.drain()
+                    remaining -= frames
+
+                writer.write_eof()
                 await writer.drain()
-                remaining -= frames
-
-            writer.write_eof()
-            await writer.drain()
 
             writer.close()
             with contextlib.suppress(ConnectionError, OSError):