From 243c865c5c72f7c7243f183eb46dc22a1e0b917e Mon Sep 17 00:00:00 2001 From: Alexander Tarasov Date: Thu, 1 Oct 2026 19:18:02 +0200 Subject: [PATCH] fix(healthcheck): Let Docker enforce HEALTHCHECK_TIMEOUT in check_http.py check_http.py gave up after a hardcoded 2 seconds, so it effectively overrode HEALTHCHECK_TIMEOUT (1m30s by default). Drop the script's own timeout and let Docker kill a check that runs past HEALTHCHECK_TIMEOUT, like it did for the previous bash check. --- healthcheck/check_http.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/healthcheck/check_http.py b/healthcheck/check_http.py index 79130ade68a..62141cb8819 100755 --- a/healthcheck/check_http.py +++ b/healthcheck/check_http.py @@ -17,15 +17,13 @@ import urllib.error import urllib.request -TIMEOUT = 2 # seconds - def main(url: str) -> int: try: # Ignore HTTP(S)_PROXY, which Docker may inject into containers: the # target is always the container itself. opener = urllib.request.build_opener(urllib.request.ProxyHandler({})) - body = opener.open(url, timeout=TIMEOUT).read().decode() + body = opener.open(url).read().decode() except urllib.error.HTTPError as exc: print(f"HTTP {exc.code} from {url}", file=sys.stderr) return 1 @@ -33,12 +31,6 @@ def main(url: str) -> int: # urlopen() wraps connection-phase failures (refused, DNS, etc.) here. print(f"{url} unreachable: {exc.reason}", file=sys.stderr) return 1 - except TimeoutError: - # A timeout firing during .read() (after urlopen returns) bubbles up - # as a bare TimeoutError from the underlying socket — not wrapped in - # URLError. Catch it explicitly so the message stays one-line. - print(f"timed out reading {url} after {TIMEOUT}s", file=sys.stderr) - return 1 except OSError as exc: # ConnectionResetError, etc. — anything else from the socket layer. print(f"error against {url}: {exc}", file=sys.stderr)