From 4ced47941d7acdc1477684b8e3c87954acc109df Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Wed, 25 Nov 2026 18:10:03 -0800 Subject: [PATCH] review fixes: relaunch test without pgrep, clear stale marker at start, VERSION 2026.11.10 - test-haproxy-supervisor-relaunch.py used `pgrep -P`, which the image does not ship (no procps): the image build failed with FileNotFoundError in 3 of the 4 real-haproxy tests. Children are now read from /proc. - haproxy-supervisor.sh: clear /tmp/haproxy-restarting at start-up. A supervisor SIGKILLed mid-recovery (docker restart) runs no EXIT trap and /tmp survives a restart, so the marker would otherwise go stale. - VERSION 2026.11.10: merging to main publishes :; 2026.11.9 is already published and must not be overwritten with different content. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6 --- VERSION | 2 +- scripts/haproxy-supervisor.sh | 4 ++++ scripts/test-haproxy-supervisor-relaunch.py | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 236dc9a..9dd5a5d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2026.11.9 +2026.11.10 diff --git a/scripts/haproxy-supervisor.sh b/scripts/haproxy-supervisor.sh index e96ab94..9209321 100755 --- a/scripts/haproxy-supervisor.sh +++ b/scripts/haproxy-supervisor.sh @@ -106,6 +106,10 @@ _stderr_log() { # same fallback as haproxy_manager._stderr_log_path() _marker_set() { printf '%s %s\n' "$(date +%s)" "$$" >"${MARKER}" 2>/dev/null || true; } _marker_clear() { rm -f "${MARKER}" 2>/dev/null || true; } trap _marker_clear EXIT +# A marker left by a supervisor that was SIGKILLed mid-recovery (`docker restart` +# kills everything after PID 1 exits; no EXIT trap runs) survives in /tmp, which +# a restart does not reset. This process never started that recovery: drop it. +_marker_clear # Direct bash relaunch. Return 0 = haproxy is up (started here or already # running), 1 = caller must fall back to ensure_haproxy.py. diff --git a/scripts/test-haproxy-supervisor-relaunch.py b/scripts/test-haproxy-supervisor-relaunch.py index fb6cbb8..7d48569 100644 --- a/scripts/test-haproxy-supervisor-relaunch.py +++ b/scripts/test-haproxy-supervisor-relaunch.py @@ -15,7 +15,7 @@ exits 134). Asserts: * a second master is never started while one is running, * an invalid on-disk config falls back to ensure_haproxy.py (python stub). -Needs a real `haproxy`, `pidof`, `bash`, `timeout`. Skips (exit 0, loudly) +Needs a real `haproxy`, `pidof`, `bash`, `timeout` (no procps: children are read from /proc). Skips (exit 0, loudly) when haproxy is not installed, so it is meaningful in the image build (where validate-rendered-config.py also needs the binary) and on a dev box with haproxy. """ @@ -69,8 +69,19 @@ def _master_pids(): def _worker_of(master): - r = subprocess.run(['pgrep', '-P', str(master)], stdout=subprocess.PIPE, text=True) - return [int(x) for x in r.stdout.split()] + """Children of `master` from /proc (the image has no procps/pgrep).""" + out = [] + for name in os.listdir('/proc'): + if not name.isdigit(): + continue + try: + with open('/proc/%s/stat' % name) as fh: + ppid = int(fh.read().rsplit(')', 1)[1].split()[1]) + except (OSError, ValueError, IndexError): + continue + if ppid == master: + out.append(int(name)) + return sorted(out) @unittest.skipUnless(HAPROXY, 'haproxy binary not installed')