[PATCH v2] resolv: Disable TCP servers in tst-resolv-res_init-failure

Florian Weimer fweimer@redhat.com
Tue Jul 21 06:50:41 GMT 2026


This avoids spurious xaccept errors on slow systems.  With this change,
the test still reproduces the original bug.

---
v2: Commented updated.
 resolv/tst-resolv-res_init-failure.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/resolv/tst-resolv-res_init-failure.c b/resolv/tst-resolv-res_init-failure.c
index d20348acf2..b3cb0b70fe 100644
--- a/resolv/tst-resolv-res_init-failure.c
+++ b/resolv/tst-resolv-res_init-failure.c
@@ -66,7 +66,22 @@ static int
 do_test (void)
 {
   struct resolv_test *aux = resolv_test_start
-    ((struct resolv_redirect_config) { .response_callback = response });
+    ((struct resolv_redirect_config)
+     {
+       .response_callback = response,
+       /* Disable TCP servers to prevent test failures due to a race
+	  condition: If the initial setrlimit call below executes
+	  before the kernel has allocated the client FD in the accept
+	  system call on the TCP DNS server threads, the system call
+	  fails even if no client connections arrive.  (The FD is
+	  pre-allocated.)  */
+       .servers =
+	 {
+	   { .disable_tcp = true, },
+	   { .disable_tcp = true, },
+	   { .disable_tcp = true, },
+	 },
+     });
 
   /* Initial lookup.  This drives __res_context_send through its init
      block, which allocates _u._ext.nsaddrs[] and sets

base-commit: 249639137ed360d1827d9e663261ba26d2b01d81



More information about the Libc-alpha mailing list