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 :<VERSION>; 2026.11.9 is
  already published and must not be overwritten with different content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-25 18:10:03 -08:00
1 parent 6df8d4b332
commit 4ced47941d
3 files changed
+19 -4

No files matched your search

+4
View File
@@ -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.
+14 -3
View File
@@ -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')