Bind without the stdlib's reverse-DNS lookup. http.server.HTTPServer.server_bind() resolves socket.getfqdn(host). On a host whose resolver does not answer for the bind address that call blocks for the resolver timeout, so the process stays alive and never reaches publish_port -- obs
| 13 | |
| 14 | |
| 15 | class FixtureHTTPServer(http.server.ThreadingHTTPServer): |
| 16 | """Bind without the stdlib's reverse-DNS lookup. |
| 17 | |
| 18 | http.server.HTTPServer.server_bind() resolves socket.getfqdn(host). On a |
| 19 | host whose resolver does not answer for the bind address that call blocks |
| 20 | for the resolver timeout, so the process stays alive and never reaches |
| 21 | publish_port -- observed on macOS Intel runners as waited=30.0s, |
| 22 | exit_status=alive, port_file=absent, empty startup log. The FQDN only |
| 23 | feeds CGI-style variables this fixture never serves, so binding without |
| 24 | it is both sufficient and immune to resolver behaviour. |
| 25 | """ |
| 26 | |
| 27 | def server_bind(self) -> None: |
| 28 | socketserver.TCPServer.server_bind(self) |
| 29 | host, port = self.server_address[:2] |
| 30 | self.server_name = host |
| 31 | self.server_port = port |
| 32 | |
| 33 | |
| 34 | def publish_port(port_file: pathlib.Path, port: int) -> None: |