Repository navigation
Integration tests: wait until stopped ZooKeeper nodes leave the container list before starting them again - #128323
Conversation
…restarting them `test_keeper_session_refuse_stale_server` failed with `Cannot wait ZooKeeper container` (kazoo `ValueError: bad hostname`): after the test's own restart one ZooKeeper node was never started again and had no IP. On Docker Engine 27.0.3 (the integration runner image), `stop` and `kill` return when the exit handler marks the container stopped, but the handler publishes that state to the view behind `GET /containers/json` only after two fsync'd config writes (moby/moby#50133, fixed in Engine 28.3). `docker compose start` lists the project once and skips every container listed as running, so when its list lands in that gap the last-stopped node gets no `POST /start` and compose still exits 0. Measured in two CI jobs: the list came ~60 ms after zoo3's stop returned and ~100 ms before its stopped state was visible. ClickHouse#109037 made the restart a single compose call, which did not help: the skip comes from the stale list, not from concurrent compose commands. `wait_integration_nodes_stopped` polls that same list (the project label, the `State` field compose checks) after `stop_zookeeper_nodes` and after `process_integration_nodes` stop/kill, and raises with the container names if they are still listed as running after 30 s. Inspect is not used as the oracle because it takes the container lock and reports `exited` before the list does. On a fixed Engine the wait is one list call. Validated in the CI runner image (Docker 27.0.3, compose 2.29.7) as a nested dockerd with an fsync delay injected: the real harness methods failed 17/20 (stop) and 19/20 (single-node kill) before, 0/20 and 0/20 after, and 19/20 again with the wait disabled. 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; 2 runs, 2 findings) plus my own review (2 findings). No blocker or major.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261030-231100 |
|
cc @leshikus, could you review this and add the |
|
Workflow [PR], commit [927b3db] Summary: ✅ AI ReviewSummaryThis PR waits until Docker's container list stops reporting the requested ZooKeeper/Keeper nodes as running after Missing context / blind spots
Final Verdict✅ Approve — no changes requested. |
88c7325
Related: #118399
Related: #116044
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The integration test harness waits until nodes it stopped or killed are no longer listed as running, so a following
docker compose startno longer skips one of them.Description
Requested in #118399. #116044 only reports the failed start; this prevents it.
test_keeper_session_refuse_stale_serverfails withCannot wait ZooKeeper containerafter kazooValueError: bad hostname: one ZooKeeper node is never started again after the test's own restart, so it has no IP. Failing jobs: #118399, arm_binary 3/4, master 509fb368, arm_binary distributed plan 3/4.Root cause: on the runner's Docker Engine 27.0.3,
stopandkillreturn beforeGET /containers/jsonshows the container stopped (moby/moby#50133; Engine 28.3 fixed it forstoponly,killstill returns early on current Engines).docker compose startlists the project once and skips every container listed as running. In both jobs the list came ~60 ms after zoo3's stop returned and ~100 ms before its stopped state was published, so zoo3 got noPOST /startand compose still exited 0. #109037 made the restart one compose call; that did not help, because the skip comes from the stale list.Change:
wait_integration_nodes_stoppedpolls that same list (bounded, 30 s, raises with the names) afterstop_zookeeper_nodesand afterprocess_integration_nodesstop/kill. When the list is already current, it is one list call.Validation: in the CI runner image (Docker 27.0.3, compose 2.29.7) with fsync delay injected into the nested dockerd, the real harness methods failed 17/20 (stop) and 19/20 (single-node kill) before, 0/20 and 0/20 after; disabling the wait brings it back (19/20). The affected tests pass locally.
Upgrading
docker-cein the runner image to >= 28.3 would fix thestoppath seen here, but notkill, so the wait stays useful after such an upgrade.Workflow [PR]
Sync PR [sync-upstream/pr/128323]
Version info
26.11.1.1398-master(included in26.11and later)