From 9fd01e5121c4f881c18b1b0d3982ddc3cbbdb3e2 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Tue, 2 Jun 2026 15:46:29 +0000 Subject: [PATCH] Keep probing for the send timeout under load 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 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/tests/system/timeouts/tests_tcp_timeouts.py b/bin/tests/system/timeouts/tests_tcp_timeouts.py index 0d0660bd81..3443b38140 100644 --- a/bin/tests/system/timeouts/tests_tcp_timeouts.py +++ b/bin/tests/system/timeouts/tests_tcp_timeouts.py @@ -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