Skip to content

Commit afde4e5

Browse files
committed
ci: run test containers with --init to fix pytest/single (PG19) Hangup flake
tests/Makefile's docker run for pytest jobs has no init process: make itself is PID 1 inside the container. GNU Make installs an explicit SIGHUP handler (to clean up partial targets on interrupt), which strips away the kernel's usual "PID 1 ignores signals with no explicit handler" protection for that signal -- any stray SIGHUP reaching the container kills the whole test run outright with no resilience: make: *** [Makefile:67: test] Hangup Seen recurring on pytest / single (PG19) across unrelated PRs (#1177's batch, and again on this branch before this commit), always the same job, never a real test assertion failing -- consistent with this being a PID-1 signal-handling gap rather than anything in the test's own logic. Add --init to DOCKER_RUN_OPTS (Makefile.docker), the single shared option list both run-test and run-test-prebuilt already use. Docker's built-in tini becomes the container's actual PID 1, correctly reaping and forwarding signals, with make demoted to an ordinary child under normal (non-PID-1) signal semantics.
1 parent 9b1bd0e commit afde4e5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Makefile.docker

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,17 @@ BASE ?= ghcr.io/hapostgres/pg_auto_failover/pgaf-base:bookworm
3434

3535
CONTAINER_NAME = pg_auto_failover
3636
TEST_CONTAINER_NAME = pg_auto_failover_test
37-
DOCKER_RUN_OPTS = --privileged --rm
37+
38+
# --init runs Docker's built-in tini as PID 1 instead of the test's own
39+
# `make` invocation. Without it, `make` (which installs its own SIGHUP
40+
# handler to clean up partial targets on interrupt) is PID 1 itself, which
41+
# strips away the kernel's usual "PID 1 ignores signals with no explicit
42+
# handler" protection -- any stray SIGHUP reaching the container then kills
43+
# the whole test run outright ("make: *** [Makefile:67: test] Hangup"),
44+
# with no resilience at all. Seen recurring on pytest/single (PG19) across
45+
# unrelated PRs; tini reaping/forwarding signals properly as a real PID 1
46+
# is the standard fix for this class of Docker footgun.
47+
DOCKER_RUN_OPTS = --init --privileged --rm
3848

3949
# DOCKER BUILDS
4050
#

0 commit comments

Comments
 (0)