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

Florian Weimer via Glibc-cvs <[email protected]> Tue, 21 Jul 2026 13:54:38 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e9996c743d48e9bdb9f82e518b174363e3d20947

commit e9996c743d48e9bdb9f82e518b174363e3d20947
Author: Florian Weimer <[email protected]>
Date:   Tue Jul 21 15:54:27 2026 +0200

    resolv: Disable TCP servers in tst-resolv-res_init-failure
    
    This avoids spurious xaccept errors on slow systems.  With this
    change, the test still reproduces the original bug.
    
    Reviewed-by: Carlos O'Donell <[email protected]>

Diff:
---
 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