]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Keep probing for the send timeout under load
authorMichal Nowak <mnowak@isc.org>
Tue, 2 Jun 2026 15:46:29 +0000 (15:46 +0000)
committerMichal Nowak <mnowak@isc.org>
Wed, 10 Jun 2026 19:15:09 +0000 (19:15 +0000)
One shot raced named; keep sending until it closes the connection.

Assisted-by: Claude:claude-opus-4-8
bin/tests/system/timeouts/tests_tcp_timeouts.py

index 0d0660bd819d30ec763506c5b6194e1b01dc9d50..3443b38140419f2c6a99062764b9bbe63909c7d6 100644 (file)
@@ -15,6 +15,7 @@ import socket
 import time
 
 import dns.edns
+import dns.exception
 import dns.message
 import dns.name
 import dns.query
@@ -202,10 +203,21 @@ def test_send_timeout(named_port):
         # above the interval
         time.sleep(6)
 
+        # named may be slow to enforce the send timeout under load; keep
+        # sending (without draining, to keep buffer pressure) until it closes.
+        deadline = time.time() + 30
         with pytest.raises(EOFError):
             try:
-                dns.query.send_tcp(sock, msg, timeout())
-                dns.query.receive_tcp(sock, timeout())
+                while time.time() < deadline:
+                    try:
+                        dns.query.send_tcp(sock, msg, timeout())
+                    except dns.exception.Timeout:
+                        # a blocked send is backpressure from named, not the
+                        # close we are waiting for; keep probing
+                        pass
+                    # pace the probes; the pressure comes from the unread
+                    # responses, not from the send rate
+                    time.sleep(0.5)
             except ConnectionError as e:
                 raise EOFError from e