Skip to content

Retry docker compose up for ZooKeeper in integration tests - #99525

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
Algunenano:fix-docker-compose-retry-zookeeper
Mar 15, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
Algunenano:fix-docker-compose-retry-zookeeper

Conversation

@Algunenano

@Algunenano Algunenano commented Mar 15, 2026 •

Copy link
Copy Markdown
Member

Wrap docker compose up -d for ZooKeeper/Keeper containers in integration tests with the existing retry() decorator (3 retries, 3s base delay).

Currently, a transient Docker-in-Docker networking race — where the daemon reports ready via docker info but the network subsystem hasn't fully initialized — causes network ... not found errors that immediately fail all tests in the shard with no recovery. Image pulls already have retry logic (line 3396 of cluster.py), but compose-up did not.

Seen in #98230: [Integration tests (amd_binary, 1/5)](https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98230&sha=3a1a2a77d4ecaffb47629f3d75243946e1c36100&name_0=PR&name_1=Integration%20tests%20%28amd_binary%2C%201%2F5%29
#98230) — all 29 tests failed identically with Error response from daemon: network roottestdistributedinterserversecret-gw1_default not found.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.3.1.683

The `docker compose up -d` calls for ZooKeeper and Keeper containers
had no retry logic, unlike image pulls which already use `retry()`.
When Docker-in-Docker's network subsystem isn't fully initialized,
the transient "network ... not found" error immediately fails all
tests in the shard.

Wrap both ZooKeeper compose-up calls (regular and secure) with the
same `retry()` decorator, using 3 retries with 3s base delay.

Seen in ClickHouse#98230:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98230&sha=3a1a2a77d4ecaffb47629f3d75243946e1c36100&name_0=PR&name_1=Integration%20tests%20%28amd_binary%2C%201%2F5%29

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7748565]

Summary: ✅


AI Review

Summary

This PR adds retry logic around docker compose up -d for ZooKeeper/Keeper startup in integration test infrastructure to mitigate transient Docker network initialization exceptions. The change is small, targeted, and consistent with existing retry usage in the same file; I did not find blocker or major correctness/safety risks in the touched code.

Missing context

  • ⚠️ CI results for this exact PR run were not included in the provided inputs, so validation here is code-based only.

ClickHouse Rules

Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsHistory.cpp ➖
Safe rollout ✅
Compilation time ✅

Final Verdict

  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 15, 2026
@Algunenano
Algunenano added this pull request to the merge queue Mar 15, 2026
Merged via the queue into ClickHouse:master with commit 3315663 Mar 15, 2026
159 checks passed
@Algunenano
Algunenano deleted the fix-docker-compose-retry-zookeeper branch March 15, 2026 22:33
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 15, 2026
pull Bot pushed a commit to AnotherGenZ/ClickHouse that referenced this pull request Sep 26, 2026
The `docker compose up -d --no-recreate` that brings up every ClickHouse node
of a module had no retry, unlike the ZooKeeper/Keeper compose ups in the same
function, so a transient Docker failure on a single container took down every
test of the module.

Seen on
https://github.com/ClickHouse/ClickHouse/actions/runs/36126873809/job/108048678812
(Integration tests (amd_tsan, 3/6) on
ClickHouse#122210, report
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=122210&sha=317cd284cb24361af84aa3a2cc1f3ad6e3865d2e&name_0=BackportPR&name_1=Integration%20tests%20%28amd_tsan%2C%203%2F6%29):
one of nine node containers failed container init with

  failed to set IPv6 gateway while updating gateway: route for the gateway
  2001:3984:3989::1 could not be found: network is unreachable

while the other eight nodes started on the same bridge in the same second,
and the three Keeper containers had been running on it for about 6 s.
`docker compose` returned 1, the module-scoped fixture died, and all 13
tests of `test_dns_cache` were reported as errors. The in-job rerun cannot
help: it only re-runs failed cases when there are fewer than 10 of them.

`up -d --no-recreate` leaves the already-running containers alone and starts
the one left in `created` state, which then re-acquires the static address
the daemon had released, so a retry recovers this state.

Retry parameters and the log function match the ZooKeeper/Keeper compose ups
in the same function, added for the same reason in
ClickHouse#99525. A deterministic startup
failure still fails, with its original message and exit code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
valerypetrov pushed a commit to valerypetrov/ClickHouse that referenced this pull request Oct 13, 2026
`ClickHouseCluster.start` ran the MongoDB and MinIO `docker compose up`
once, so a transient per-container daemon error lost the whole module.
On 26.7 the MongoDB up failed with

    failed to create endpoint roottesttablefunctionmongodb-gw0-mongo1-1 on
    network roottesttablefunctionmongodb-gw0_default: failed to add the host
    (veth2d10e1f) <=> sandbox (veth2d10e1f) pair interfaces: file exists

and all 16 tests of `test_table_function_mongodb` failed:
https://github.com/ClickHouse/ClickHouse/actions/runs/38284747320/job/114936343879
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=26.7&sha=bc135b699eafe550939f3eb17885f541f5dfa226&name_0=ReleaseBranchCI&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%205%2F8%29

CI's docker-ce 27.0.3 draws the host-side and the container-side veth
names independently and never compares them, so with probability 2^-28
per endpoint both ends get the same name and the pair cannot be created.
The same error hit the MinIO up on
ClickHouse#119134
(https://github.com/ClickHouse/ClickHouse/actions/runs/36144124883/job/108126010556),
and an OOM-killed container init failed it on master
(https://github.com/ClickHouse/ClickHouse/actions/runs/33353696579/job/99381397549).

`up -d` converges: running containers are left alone and the container
left in `created` state is started, so another attempt recovers. Add a
`compose_up` helper with the retry the ZooKeeper/Keeper and ClickHouse
node ups already use (ClickHouse#99525, ClickHouse#122343), and route those three sites and
the MongoDB and MinIO ups through it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants