fix(pluginsdk): skip reverse DNS when a Python plugin binds

HTTPServer.server_bind resolves the listen address with socket.getfqdn,
which stalled a remote-mode plugin's startup past the conformance test's
wait on the macOS runner. Nothing uses the name. The test now also bounds
each health probe and waits up to 30s.
This commit is contained in:
wizardchen
2026-09-26 10:00:20 +08:00
parent 5f1245351f
commit cdd8f7feba
3 changed files with 26 additions and 3 deletions
@@ -526,6 +526,12 @@ class _TCPServer(_Server):
self.address_family = socket.AF_INET6
super().__init__(address, *args)
def server_bind(self) -> None:
# HTTPServer.server_bind looks the host up with getfqdn, a reverse
# DNS query that can stall startup for seconds; nothing needs it.
socketserver.TCPServer.server_bind(self)
self.server_name, self.server_port = str(self.server_address[0]), int(self.server_address[1])
class _UnixServer(_Server):
address_family = getattr(socket, "AF_UNIX", socket.AF_INET)
+11
View File
@@ -144,6 +144,17 @@ class PluginTest(unittest.TestCase):
self.assertEqual(events[1]["error"], {"code": "rate_limited", "message": "slow down", "retryable": True, "details": {"retryAfter": 7}})
class BindTest(unittest.TestCase):
def test_no_reverse_dns_on_bind(self):
# getfqdn can stall startup for seconds where reverse DNS is slow.
from unittest import mock
with mock.patch("socket.getfqdn", side_effect=AssertionError("getfqdn called")):
server = plugin.test_server()
server.shutdown()
server.server_close()
class WireTest(unittest.TestCase):
def test_times(self):
t = parse_time("2026-09-25T16:22:58.135616789Z")