Repository navigation
Fix flaky genuine ZooKeeper startup in test_keeper_zookeeper_converter - #110631
Conversation
`test_keeper_zookeeper_converter` occasionally fails on a busy CI host with:
Command [... /opt/zookeeper/bin/zkServer.sh start] return non-zero code 1:
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
`copy_zookeeper_data` restarts genuine ZooKeeper after converting its data,
and `zkServer.sh start` keeps the freshly launched JVM for only one second
before it checks that the process is still alive. When that racy check loses,
the script prints an opaque "FAILED TO START" (exit code 1) without saying
why. In the observed failure the same data directory had started fine a few
seconds earlier and a re-run started it successfully ~3 seconds after the last
failed attempt, so the JVM is transiently killed or slow to come up under load
rather than the data being broken - but the existing 5x/16s retry window was
just too short to ride it out.
Instead of trusting the script's exit code, `start_zookeeper` now waits until
ZooKeeper actually accepts connections on its client port, cleans up any
half-started JVM between attempts (a lingering one keeps the client port busy
and makes every retry fail), and dumps the ZooKeeper daemon logs when it never
becomes ready so residual failures are diagnosable from CI artifacts instead
of leaving only "FAILED TO START". It still fails loudly if ZooKeeper truly
cannot start, so real problems are not masked.
CI report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=e590300d41503a2abbaef54d88306e56cba6dd71&name_0=MasterCI&name_1=Integration%20tests%20%28amd_tsan%2C%203%2F6%29
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [32f35e6] Summary: ✅ AI ReviewSummaryThis PR hardens Final VerdictStatus: ✅ Approve |
…r-converter-start-flaky
The AI review on the PR flagged two issues with `start_zookeeper`: a bare TCP connect to port `2181` can succeed before the standalone server can actually serve requests, and the 20s per-attempt deadline was too short for a healthy but slow snapshot load — it would get killed and retried on every attempt. `nothrow=True` also dropped `zkServer.sh start`'s `stderr`, so a failure before the daemon log existed collapsed to an opaque message. `_wait_zk_client_ready` now probes readiness the same way the rest of the harness does (a real Kazoo request via `cluster.get_kazoo_client`, as in `get_genuine_zk`/`ClickHouseCluster.wait_zookeeper_to_start`), with a 60s per-attempt deadline instead of 20s. The last `zkServer.sh start` output is captured with `2>&1` and included in the exception raised on terminal failure.
|
The @groeneai, a fix already appears to be in progress at #110145 — please let me know if that's still the right one, or link an alternative fix if it's superseded. |
|
Yes, #110145 is the right fix and is current (open, not superseded). It closes #110036 at the server-side root cause: on Our #110030 (test-only, Note the test is still failing on master (last 12d: 07-15 x7, 07-14 x19, 07-13 x16) because #110145 has not merged yet. |
…eper-converter-start-flaky Fix flaky genuine ZooKeeper startup in test_keeper_zookeeper_converter
Fixes a flaky failure of
test_keeper_zookeeper_converterseen on master CI (Integration tests (amd_tsan, 3/6)and other flavors).copy_zookeeper_datarestarts genuine ZooKeeper after converting its data.zkServer.sh startkeeps the freshly launched JVM for only one second before checking that the process is still alive, and prints an opaqueFAILED TO START(exit code 1) without saying why when that racy check loses:In the observed failure the same data directory had started fine a few seconds earlier and a re-run started it successfully ~3 seconds after the last failed attempt, so the JVM is transiently killed or slow to come up under load rather than the data being broken — but the existing 5×/16s retry window was just too short to ride it out.
Instead of trusting the script's exit code,
start_zookeepernow:FAILED TO START.It still fails loudly if ZooKeeper truly cannot start, so real problems are not masked.
No existing open tracking issue was found for this flaky test.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=e590300d41503a2abbaef54d88306e56cba6dd71&name_0=MasterCI&name_1=Integration%20tests%20%28amd_tsan%2C%203%2F6%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog (CI-only test change).
Documentation entry for user-facing changes
Version info
26.7.1.1036(included in26.7and later)