Repository navigation
Keep the autoheal sidecar from restarting a postgres1 that La Casa Del Dolor paused - #133501
Conversation
…l Dolor paused La Casa Del Dolor (amd_debug) failed with `dolor.py exception` on unrelated PRs: `docker compose ... unpause postgres1` returned "Container ... is not paused". Docker reports a paused container that has a healthcheck as unhealthy (pausing closes its health monitor) and keeps that status after the unpause until the next probe, which runs only after `interval` (10 s for postgres1). The postgres compose file labels postgres1 `autoheal=true` and runs the willfarrell/autoheal sidecar, which restarts every labelled unhealthy container every 5 s after a 600 s start period (ClickHouse#79360). La Casa runs 15 minutes and pauses integrations since ClickHouse#131994, so a postgres pause after minute 10 is restarted by the sidecar: the restart resumes the container and the unpause fails. The dockerd debug logs of both failing runs show pause, the sidecar's `health=unhealthy` query, `restart?t=10`, then the failed unpause. When dolor pauses postgres1 it now pauses the sidecar first, and resumes it once postgres1 is healthy again. Resuming it right after the unpause is not enough, because the status is still unhealthy until the first probe. The wait is bounded at 60 s, after which the sidecar is resumed anyway, so a postgres that stays unresponsive after a pause is still healed (the reason ClickHouse#79360 added the sidecar). Not chosen: pausing with SIGSTOP (`docker kill --signal`) freezes only the postmaster, so established connections keep answering and clients see no hang, which defeats the purpose of the pause; stopping the sidecar for the whole run drops the recovery; making `unpause` tolerate a running container would hide that the pause turned into an unscheduled restart. Validated locally (no committed test: fuzzer harness change): with the current sequence `unpause` fails 5/5; with the new one 5/5 runs have no restart and no error, and postgres is healthy about 10 s after the unpause. A temporary integration test on the real compose file reproduced the CI exception after the 600 s start period and ran the new sequence 3/3 cleanly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings), plus my own cold review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261122-070400 |
|
cc @PedroTadim, could you review this? La Casa Del Dolor pauses postgres1 since #131994, and the autoheal sidecar of docker_compose_postgres.yml restarts it because Docker reports a paused container as unhealthy, so the unpause fails with 'is not paused'; dolor now pauses the sidecar during a postgres pause and resumes it once postgres1 is healthy again (at most 60 s). |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261122-063300 |
|
Workflow [PR], commit [fa28476] Summary: ✅ AI ReviewSummaryThe PR stops Final VerdictStatus: ✅ Approve |
Review of ClickHouse#133501: pausing the sidecar keeps its in-flight requests. A `GET /containers/json` it sent just before the pause can be answered by the daemon after postgres1 is paused, so the answer lists postgres1 as unhealthy, and the resumed sidecar restarts it from that list without checking again (autoheal 1.2.0 entrypoint), even though postgres1 is healthy by then. dolor now pauses the sidecar, checks that no `curl` runs in it, and if one does, unpauses it, waits 0.2 s and tries again, for at most 40 s (above the sidecar's CURL_TIMEOUT of 30 s). With no request in flight when postgres1 is paused, the first request after the resume is a fresh query of a healthy postgres1. If a request is still in flight after 40 s, postgres1 is restarted with stop/start instead of the pause: the sidecar lists only running containers, so it cannot restart a stopped one. The check reads the frozen process tree from /proc, not `docker top`: the autoheal image has its own healthcheck (every 5 s), its exec stalls in the paused container, and `docker top` waits behind it in the containerd shim. Measured: one `top` call blocked past the 60 s client timeout. dolor runs next to the docker-in-docker daemon it drives, so the container's `State.Pid` is valid in its /proc. Validated with a unix socket proxy between the sidecar and dockerd that holds the sidecar's list request until postgres1 is paused (the ordering from the review), on Docker 29.5.1 and on dockerd 27.0.3 in the integration runner image: the previous sequence restarted the healthy postgres1 3/3, this one 0/3. Ordinary pauses 5/5 without a restart; 300 drains against a sidecar polling without a sleep returned paused with no `curl` every time (39-61 retried, slowest 2.1 s); a request held past 40 s takes the stop/start path with no sidecar restart; a postgres that stays unresponsive after the pause is still healed. On the real docker_compose_postgres.yml after the 600 s start period, master's sequence raised the CI exception and the new restart block ran 3/3 without a restart. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵️ @groeneai The analysis is right and the code works, but this is a lot of machinery to keep a sidecar La Casa does not need. # The sidecar restarts a paused postgres1, which Docker reports as unhealthy, so dolor's unpause fails
cluster.process_integration_nodes("postgres", ["autoheal"], "stop")That keeps the pause a pause and drops the |
…tgres pause Review of ClickHouse#133501 (@ PedroTadim): La Casa Del Dolor does not need the sidecar. `postgres1` has `restart: always`, and dolor stops, kills and starts it at random, so a `postgres1` that hangs is restarted by the next restart dolor picks. The sidecar only exists for the pause false positives of the integration tests (ClickHouse#79360). So dolor now stops it once after the cluster starts, when PostgreSQL is enabled, and drops the /proc walk, the drain loop and the health wait of the two previous commits. A stopped `restart: always` container stays stopped: Docker restarts it only on a daemon restart or an explicit start, and `docker compose start postgres1` starts only `postgres1`. Validated with a temporary integration test on the real docker_compose_postgres.yml, past the sidecar's 600 s start period: the control (sidecar left running) raised the CI exception `unpause postgres1 ... is not paused`, and with this line executed from dolor.py the sidecar stayed exited (RestartCount 0) through pause/unpause, stop/start and kill/start of `postgres1`, every unpause succeeded and `postgres1` was not restarted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Done in fa28476: dolor stops the sidecar once after the cluster starts when PostgreSQL is enabled (your line), and the drain loop, the |
Related: #131994
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Failure. La Casa Del Dolor (amd_debug) fails with
dolor.py exception:docker compose ... unpause postgres1returnsError response from daemon: Container ... is not paused. Seen on two unrelated PRs: #121944, #129649.Root cause. Docker reports a paused container with a healthcheck as
unhealthy.docker_compose_postgres.ymlruns theautohealsidecar, which restarts unhealthypostgres1every 5 s once its 600 s start period (#79360) is over. La Casa runs 15 minutes and, since #131994, pauses integrations, so a postgres pause after minute 10 gets restarted. The restart resumes the container and theunpausefails. Both runs' dockerd logs showpause, the sidecar'shealth=unhealthyquery,restart, then the failedunpause.Change. After the cluster starts, when PostgreSQL is enabled, dolor stops the sidecar for the rest of the run, so a paused
postgres1stays paused until dolor unpauses it. La Casa does not need the sidecar:postgres1hasrestart: always, and dolor stops, kills and starts it at random, so a hungpostgres1is restarted by the next restart dolor picks. On sanitizer runs dolor restarts no integration, and the sidecar could only act after minute 10. The integration tests keep it. No other compose file has an autoheal sidecar.Validation. A temporary integration test on the real
docker_compose_postgres.yml, past the sidecar's 600 s start period: with the sidecar running, pausing and unpausingpostgres1raised the CI exception. With the line fromdolor.pyrun aftercluster.start(), the sidecar stayed exited (RestartCount0) through 4 pause/unpause, 1 stop/start and 1 kill/start ofpostgres1; every unpause succeeded, no pause restarted it, andSELECT 1worked after each.Alternative: revert the pause/unpause lines #131994 added to
dolor.py.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/133501]
Version info
26.12.1.279-master(included in26.12and later)