From e18d5b1ef960e4890e7f1fd542b81e21831a9c46 Mon Sep 17 00:00:00 2001 From: Transaction Science Date: Thu, 5 Nov 2026 15:47:23 -0500 Subject: [PATCH] wai dev's test: the stand-in room service listens without a reverse lookup The macOS job of cargo-class corpora failed in tests/cli_studio.rs with "the room service's clock on the relay: not within 30 s". The whole test took 30.58 s, so the stand-in relay and everything before it took under 0.6 s, and only the stand-in room service stalled. The two run the same script. What differs is that the room service starts an HTTPServer, whose server_bind calls socket.getfqdn before the server listens. That reverse lookup waits on the system's resolver. Nothing here reads the name, so the fixture no longer asks for it. A socket.getfqdn planted to stall for 40 s reproduces the failure, with the same message and at 30.18 s, and with this change the same plant passes in 0.30 s. A lookup on that host took 1 to 10 ms when measured afterwards, so this is the one difference between the two processes rather than an observed stall. Changelog: none Co-Authored-By: Claude Opus 5.5 --- wai/wai-rs/tests/fixtures/dev-stack/fake-stack.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wai/wai-rs/tests/fixtures/dev-stack/fake-stack.py b/wai/wai-rs/tests/fixtures/dev-stack/fake-stack.py index cce944f03..8b41ff27a 100755 --- a/wai/wai-rs/tests/fixtures/dev-stack/fake-stack.py +++ b/wai/wai-rs/tests/fixtures/dev-stack/fake-stack.py @@ -15,6 +15,7 @@ import json import os import re import socket +import socketserver import sys import threading import time @@ -55,6 +56,15 @@ class Room(http.server.BaseHTTPRequestHandler): pass +class Server(http.server.ThreadingHTTPServer): + """HTTPServer looks up a name for its address before it listens. That waits on the system's + resolver, and nothing here reads the name, so a slow answer would only look like a service + that never came up.""" + + def server_bind(self): + socketserver.TCPServer.server_bind(self) + + def main(argv): if argv[:1] in (["keygen"], ["relay-lines"]): open(argv[1], "a").close() @@ -73,7 +83,7 @@ def main(argv): while True: c, _ = s.accept() c.close() - http.server.ThreadingHTTPServer(listen_addr(config, "listen"), Room).serve_forever() + Server(listen_addr(config, "listen"), Room).serve_forever() return 0 -- 2.54.0 (Apple Git-157)