Repository navigation
Extend Run server init.d retry budget from 5s to 30s - #106056
Conversation
The `initd_test` script in `ci/jobs/install_check.py` retries `clickhouse-client -q 'SELECT version()'` 5 times with `sleep 1` between attempts after the init.d wrapper returns "Server started". On slow CI hosts the server takes longer than 5 seconds to open the TCP listener after the wrapper has printed "Server started" (which only checks that the pid file exists). The test then fails with `Code: 210. DB::NetException: Connection refused (localhost:9000)`. CIDB shows 3 master hits in 30 days with identical failure mode across 3 versions (26.5.1.507, 26.6.1.88, 26.6.1.216). For the most recent hit, the preserved `clickhouse-server.log` shows the server process forked at `13:35:50.269225` and the `preserve_logs.sh` trap copied the log at `13:35:50.586761`, only ~317 ms after fork: the server had not yet reached the listener-open stage by the time the test gave up. The sibling `keeper_test` block in the same file already uses a 20-iteration loop with `/dev/tcp` for the same purpose. Bumping `initd_test` to 30 iterations brings the budget in line and removes the spurious failures; passing runs still complete on the first iteration because the loop breaks early. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=549ac9afd4ee4fd58d177ad5b7b88b4a517805d6&name_0=MasterCI&name_1=Install%20packages%20%28amd_release%29 Related: ClickHouse#86278
Pre-PR validation gatea. Deterministic repro? Not locally (this is a Docker-based packaging test against a pre-built b. Root cause? c. Fix matches root cause? Yes. The fix extends the retry budget that previously timed out. It does not weaken any assertion: the final unconditional d. Test intent preserved? Yes. The test still asserts (i) init.d-started server is reachable via e. Demonstrated in both directions? Without the fix: 3 documented master failures over 30 days with the same retry-exhaustion signature. With the fix: passing runs still break out of the loop on the first iteration, so there is no added latency on the happy path. CI on this PR will validate the deb install path on the same f. Fix is general, not a narrow patch? Considered: Session: cron:clickhouse-ci-task-worker:20260528-143000 |
|
cc @leshikus — could you review? It's a one-line CI test fix bumping the retry loop from 5 to 30 iterations to absorb slow listener bind on the Install packages (amd_release) host (3 master hits in 30 days). |
leshikus
left a comment
There was a problem hiding this comment.
The fix does not make the code worse, yet the polling design is prone to errors. Better to use callbacks instead when possible.
|
Workflow [PR], commit [4bc9ee0] Summary: ✅ AI ReviewSummaryThis PR extends the Tests
Final VerdictStatus: Minimum required action: get a passing |
Fix flaky `Run server init.d` install check on 25.8 (backport of #106056)
|
@alexey-milovidov could you apply
Both forms have been running side by side since this merged: 4 failures of this signature in 863
|
The `initd_test` script in `ci/jobs/install_check.py` on `25.8` runs `clickhouse-client -q 'SELECT version()'` exactly once, immediately after the init.d wrapper prints `Server started`. The wrapper only checks that the pid file exists, but on a slow CI host (notably the `amd_debug` build) the server can take several seconds longer to open the TCP listener on port 9000. The test then fails with `Code: 210. DB::NetException: Connection refused (localhost:9000)`. In the same job the sibling `binary_test` already retries `SELECT version()` in a loop, and on `25.8` backport runs it routinely takes ~4 seconds (4 retries) before the debug server accepts connections, while `initd_test` gives up after the first attempt. This is the same failure mode as ClickHouse#86278, which was fixed on `master` by ClickHouse#106056 ("Extend `Run server init.d` retry budget from 5s to 30s"). That fix never reached `25.8`, so the flake keeps blocking `25.8` backport PRs (for example ClickHouse#108965 and ClickHouse#108917). Because the `25.8` `initd_test` predates the retry loop entirely, ClickHouse#106056 does not cherry-pick cleanly; this commit adapts the same fix by adding a 30-iteration poll loop that breaks early on success, matching the existing `binary_test` and `keeper_test` patterns. `SYSTEMCTL_SKIP_REDIRECT` is intentionally not added, since the `25.8` init.d script does not support it. Related: ClickHouse#86278, ClickHouse#106056 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Motivation
The
Run server init.dtest in theInstall packages (amd_release)job has been failing intermittently on master with the same pattern across 3 different ClickHouse versions in the last 30 days:66ce9a35d04f94976df6f78a549ac9afd4eeAll three runs end with the same tail:
Root cause
The
initd_testscript inci/jobs/install_check.pypollsclickhouse-client -q 'SELECT version()'only 5 times withsleep 1between attempts after the init.d wrapper returns. The wrapper printsServer startedonce the pid file exists, but the TCP listener on port 9000 can take longer than 5 seconds to bind on a slow CI host.The preserved
clickhouse-server.logfrom the 2026-05-28 hit confirms this: the server process forked at13:35:50.269225, andpreserve_logs.sh(thetrap ... ERRhandler) copied the log at13:35:50.586761— only ~317 ms after fork. The server had not yet reached the listener-open stage by the time the test gave up.The sibling
keeper_testblock in the same file already uses a 20-iteration loop with a/dev/tcpprobe for the same purpose. This PR alignsinitd_testwith that pattern by bumping the retry budget from 5 to 30 iterations. Passing runs still complete on the first iteration because the loop breaks on the first successful client call.Related
CI Reports
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.6.1.228