Skip to content

Fix flaky test_zookeeper_fallback_session by waiting for zoo1 to catch up before asserting fallback - #114055

Merged
PedroTadim merged 3 commits into
ClickHouse:masterfrom
groeneai:fix-flaky-zookeeper-fallback-session-zxid-wait
Aug 12, 2026
Merged

PedroTadim merged 3 commits into
ClickHouse:masterfrom
groeneai:fix-flaky-zookeeper-fallback-session-zxid-wait

Conversation

@groeneai

@groeneai groeneai commented Aug 9, 2026 •

Copy link
Copy Markdown
Collaborator

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):

...

Description

test_fallback_session fails as assert 'zoo2' == 'zoo1' at test.py:112: 5 hits on 5 unrelated PRs
in 30 days, 7 on 7 over 60 days, on four build flavours. No master hits; one further 60-day row is
on the 26.5 release branch.

Root cause: the test asserts a convergence the contract does not promise. Since c39cac20ff8 Keeper
refuses a reconnecting client whose last_zxid_seen exceeds that host's applied zxid ("The client
should try another server", KeeperTCPHandler.cpp:352), and the client keeps that watermark across
session restarts, so connect falls through to the next host. In the final phase zoo1 is a follower
applying the log asynchronously (async_replication=1), so a node reconnecting in that window lands
on zoo2 and stays: in_order has hasOptimalNode() == false, so the ZKReconnect task that would
move it back is never armed. A longer retry budget cannot help.

Fix: before blocking zoo3 and asserting re-convergence, wait until zoo1 has applied everything the
nodes have seen, closing the multi-second catch-up window these failures came from. Not absolute: the
cluster keeps committing, so a watermark can still advance between wait and handshake. On timeout the
wait reports both zxids instead of the bare 'zoo2' == 'zoo1'. srvr's Zxid is the right oracle:
it and the handler's check both read KeeperStorage::getZXID().

Validated by freezing zoo1's inbound Raft traffic. Without the wait it fails with the original
signature and zoo1 logs Refusing session as the client has seen zxid 161 while our last processed zxid is 146; with it it passes, no refusals. A control arm keeping the helper but not awaiting it
fails again. Sequential runs green: 50 on the previous revision, 10 on this one.

A production in_order deployment can be pinned the same way; that Keeper change is for its owners.

Related: #113575, where a separate fix PR was requested.

Version info

  • Merged into: 26.8.1.1278 (included in 26.8 and later)

…h up

test_fallback_session failed as "assert 'zoo2' == 'zoo1'" at test.py:112 on
5 unrelated PRs in the last 30 days (7 on 7 PRs over 60 days), on arm_binary,
amd_asan_ubsan, amd_tsan and amd_msan. There are no master failures; one
further 60-day row is on the 26.5 release branch.

The test asserted a convergence the client/server contract does not
promise. Since c39cac2 a Keeper refuses a reconnecting client
whose last_zxid_seen exceeds that host's own applied zxid, telling it to
try another server (KeeperTCPHandler.cpp:352, :356). The client carries
that watermark across session restarts by design (ZooKeeper.cpp:395-398,
:1539), and Coordination::ZooKeeper::connect falls through to the next
priority host on a handshake failure, so a refusal by zoo1 demotes the
node to zoo2.

In the final phase zoo1 is a Raft follower applying the tail of the log
asynchronously - the fixture sets async_replication=1 - so a node whose
reconnect lands inside that window is refused by zoo1 and ends up on
zoo2. It then stays there: in_order has hasOptimalNode() == false, so
may_benefit_from_reconnecting is false and the ZKReconnect task that
would move it back to the optimal host is never armed
(ZooKeeper.cpp:236-237). A longer retry budget therefore cannot help.

Wait for zoo1 to apply everything the nodes have already seen before
blocking zoo3 and asserting re-convergence, which closes the multi-second
catch-up window these failures came from. The invariant has to hold on two
consecutive samples, so a single stale snapshot is not enough to proceed.
It is still not an absolute guarantee: the cluster keeps committing and
every heartbeat response carries a zxid, so a client watermark can advance
between the wait and the handshake. The wait removes the window that was
actually observed.
srvr's Zxid is the right oracle because it and the handler's check both
read KeeperStorage::getZXID() (FourLetterCommand.cpp:430 ->
KeeperStorage.cpp:1279; KeeperStateMachine.cpp:1917-1921). Note this
fixture's Keepers listen on 2181, not the 9181 default of keeper_utils.

Every existing assertion is unchanged, so the diff is purely additive.
On timeout the wait reports zoo1's applied zxid and the clients'
watermark instead of degrading into the uninformative original
assertion.

Verified by widening the race deterministically (freezing zoo1's inbound
Raft traffic): without the wait the test fails with the original
signature and zoo1 logs "Refusing session as the client has seen zxid
161 while our last processed zxid is 146"; with it the test passes and
logs no refusals. A control arm that keeps the helper but does not await
it fails again, so the pass comes from the wait itself. Sequential runs
are green: 50 on the previous revision, 10 on this one, which adds the
two-consecutive-samples requirement.

The helper treats a missing system.zookeeper_connection row as "not known
yet" and keeps polling rather than reading it as a low watermark: the
table has no row while a session has no connected host, which is exactly
the state a reconnect passes through. It also samples the clients after
zk_node, because a client watermark advances on every heartbeat response
and one sampled earlier could already be stale.

Not addressed here: a production in_order deployment can be pinned to a
suboptimal Keeper the same way, since ZKReconnect is only armed when
hasOptimalNode() is true. That is a Keeper connection-management change
and is left to the Keeper owners.
@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review - 7 findings agreed and fixed, 4 disagreed with evidence, 1 noted

Independent review of this change by a second model over six rounds, plus my own cold
review each round, adjudicated against the recorded evidence. Everything agreed below was
fixed before this push.

Finding Verdict
❌ The commit message claimed the failing run exhausted "all 23 polls" on zoo2. assert_uses_zk_node calls query_with_retry without an override, so the budget is the default retry_count=20 (cluster.py:5115) and 23 polls of one node is unreachable; 23 is the 20-poll budget plus the three earlier zoo3 assertions AGREE - removed. The structural argument (in_order never arms the reconnect task) already establishes that a longer budget cannot help, so the claim needed no count
❌ wait_zk_node_caught_up can be overtaken: a client's last_zxid_seen advances on any response including heartbeats (ZooKeeperImpl.cpp:1140-1142 stores unconditionally, before the PING_XID dispatch; KeeperStorageImpl.cpp:1937 attaches commit_zxid), and startNewSession copies the later value, so a refusal remains possible after the wait returns AGREE - the wait is a narrowing, not a guarantee. An earlier draft claimed otherwise in both the description and the commit message; corrected. The wait now also requires the invariant to hold on two consecutive samples
⚠️ The same finding prescribed a barrier "that cannot be overtaken", and a deterministic lag phase inside the committed test (raised four times) DISAGREE - not achievable from a test. last_zxid_seen is a private atomic with a getter and no setter (ZooKeeperImpl.h:252, :405), it appears in no setting, and the writer is the server's own heartbeat response path, so nothing a test can call freezes it. The only true barrier is iptables injection of zoo1's Raft port, which cannot be committed: on this PR's own harness the follower guard aborted 7 attempts because zoo1 had been elected leader, so an in-test assertion of the lag precondition would fail on those runs - trading a rare flake for a frequent one. The injection stays in the throwaway A/B harness, where it already discriminates three arms
⚠️ Suggestion: retry the clients that land on zoo2 instead of waiting DISAGREE - once refused, the client is pinned. in_order gives hasOptimalNode() == false (GetPriorityForLoadBalancing.cpp:101-102) so no reconnect task is armed (ZooKeeper.cpp:236-237), and assert_uses_zk_node already retries 20 times, which is what the failing run did over 10.8 s without moving. Retrying the session rather than the query does not help either: SYSTEM RECONNECT ZOOKEEPER only calls finalize() (Context.cpp:5916-5924), and the reconnect goes back through the same startNewSession that carries the watermark forward (ZooKeeper.cpp:1539) into the same host list, so it re-enters the identical refusal
⚠️ Suggestion: relax the exact-host assertion to accept the fallback host DISAGREE - the test exists to prove in_order returns to the optimal host, so accepting zoo2 removes its purpose
⚠️ The committed test cannot tell a working wait from a removed one (raised four times) DISAGREE on the evidence. The two arm files are byte-identical and differ only in whether the wait is awaited, so file, import and helper body are held constant: the not-awaited arm fails with 3 refusals and the original signature, the awaited arm passes with none. Premature return is covered separately by a fake-based probe run against the previous helper as a mutation arm, which reddens there and passes here. A wait that never satisfies raises naming both zxids rather than passing quietly, and 0 spurious timeouts were seen across the soak
❌ The breadth figure counted the 26.5 release-branch row inside the PR total: "8 on 7 PRs over 60 days". Over 60 days there are 8 matching rows but only 7 are PR rows, on 7 distinct PRs; the 8th is pull_request_number = 0, head_ref = '26.5'. The message then disclosed that same row separately two lines later, so it contradicted itself AGREE - corrected to "7 on 7 over 60 days" with the release row named separately. Re-measured rather than reasoned: 60d rows=8, pr_rows=7, distinct_prs=7, nonpr_rows=1; 30d 5/5 unchanged
❌ The breadth figure claimed one master failure AGREE - wrong. head_ref='master' over 60 days is 0; the single non-PR row is head_ref='26.5', a release branch. The 30-day figure is 5 hits on 5 PRs, matching the number already quoted on #113575
❌ "50 sequential runs green" did not say which revision. The 50-run soak ran on the previous revision; this one changes the helper's exit condition and received 10 runs AGREE - both the description and the commit message now name the counts per revision
⚠️ get_max_client_zxid raised ValueError on a zero-row read: system.zookeeper_connection emits no row while a session has no connected host, exactly the state a reconnect passes through AGREE - it now returns None and the wait keeps polling. One absent row poisons the whole reading, so a maximum is never taken over a subset
💡 None conflated "behind" with "unreadable" in the timeout message; and the only linked PR sat inside an HTML comment so it did not render AGREE - the two None cases are rendered distinctly, and the link to #113575 is now visible
💡 get_max_client_zxid uses a bare node.query() where the file's other reader of the same table uses query_with_retry Noted, not changed. The reachable case is an empty result, which is handled; a raised exception needs every configured Keeper unreachable (Context.cpp:5770-5800), and at this call site the partition block has exited and the session is live on zoo3

Also checked and not changed: srvr's Zxid and the handler's comparand are the same
function (KeeperStorage::getZXID()), so the oracle is exact; this fixture's Keepers listen
on 2181, not the keeper_utils default of 9181, which would have made both the wait and the
injection silently no-op; the zoo3 assertions are measured not to be carriers, so no wait
was added there; every pre-existing assertion is byte-for-byte unchanged. Breadth was
re-measured rather than quoted: 5 hits on 5 PRs in 30 days, 7 on 7 in 60, and 0 with
head_ref = 'master' at both 60 and 90 days.

The residual is stated rather than hidden: the wait closes the observed multi-second
catch-up window but is not a barrier, so a watermark can still advance between the wait and
the handshake. Removing that last window needs a Keeper connection-management change (arm the
reconnect for in_order, or retry the preferred host after a SESSION_REFUSED), which is
left to the Keeper owners rather than folded into a test fix.

@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (a)-(i)
# Check Result
a Deterministic repro? Yes. Freezing zoo1's inbound Raft traffic (iptables -A INPUT -p tcp --dport 9444 -j DROP) makes the failure appear on demand, together with the causal line in zoo1's own log: Refusing session as the client has seen zxid 161 while our last processed zxid is 146. Every run asserts the injection is real (zoo1 readable, still a follower, at least one client watermark above its applied zxid) before any verdict is trusted; four earlier injection attempts were rejected by those guards rather than reported as results.
b Root cause explained? Yes. A Keeper refuses a reconnecting client whose last_zxid_seen exceeds that host's applied zxid (KeeperTCPHandler.cpp:352, message at :356, added by c39cac20ff8). The client carries that watermark across session restarts (ZooKeeper.cpp:395-398, :1539), and connect falls through to the next host on handshake failure, so a refusal by zoo1 demotes the node to zoo2. in_order has hasOptimalNode() == false, so ZKReconnect is never armed (ZooKeeper.cpp:236-237) and the demotion is permanent. async_replication=1 in the fixture creates the follower apply-lag window.
c Fix matches root cause? Yes. The test relied on an untested precondition (follower catch-up timing); the fix establishes that precondition before asserting on it. Not a widened bound, not a no-random-*/no-parallel tag, not a dataset reduction, and not a server-side guard. srvr's Zxid is a sound oracle because it and the handler's check both read KeeperStorage::getZXID() (FourLetterCommand.cpp:430 -> KeeperStorage.cpp:1279; KeeperStateMachine.cpp:1917-1921).
d Test intent preserved? Yes, and mechanically checkable: the diff is +92/-0, so every pre-existing assertion is byte-for-byte unchanged. The test still fails when the nodes genuinely do not converge on zoo1, which the control arm below demonstrates.
e Both directions demonstrated? Yes, three arms under one injection. Pristine HEAD: FAIL assert 'zoo2' == 'zoo1', 3 refusals. With the fix: PASS, 0 refusals. Control (helper present in the file but not awaited): FAIL again, 3 refusals. The control isolates the wait's body from its mere presence. Repeated: pristine 2/2 FAIL, fixed 2/2 PASS, control 2/2 FAIL, each with a verified-valid injection. Both arm files were byte-diffed against git show HEAD:... and the worktree respectively. Because a race cannot deterministically produce a zero-row read, a watermark that advances mid-iteration, or a sample that satisfies the invariant once and then stops, those are additionally covered by a fake-based probe run against a mutation arm (the previous helper), which reddens there and passes on the current one.
f General across code paths? Yes, carriers enumerated. The reported site is fixed. The zoo3 assertion in the first partition block is measured not a carrier (0 refusals in keeper3's log across 50 clean runs and all injected runs), so no wait is added there rather than shipping dead code. The post-revert zoo3 assertion asserts no movement and is unaffected. The server-side refusal and fall-through paths are deliberately unchanged: the refusal is intentional monotonic-read protection whose own message directs the client elsewhere.
g General across inputs? Yes on the axis that applies here (Keeper role and reachability). A leader trivially satisfies the predicate. A Keeper that is not serving requests answers srvr with no Zxid line, which is treated as not caught up (fail-closed). Symmetrically, system.zookeeper_connection has no row while a session has no connected host (fillData guards on index != -1), the state a reconnect passes through; that read returns None and keeps the loop polling instead of raising ValueError or being mistaken for a low watermark, and an absent row on any one node poisons the whole reading rather than yielding a max over a subset. The two failure modes are distinguished in the timeout message (unreadable (not serving requests?) vs unknown (reconnecting)). An already-satisfied watermark returns after two consecutive confirming samples, i.e. one extra 0.2s poll, so the added latency is bounded and the clean runs stay green.
h Backward compatible? N/A, tests only. No settings, no SettingsChangesHistory.cpp, no serialization format, no user-visible behaviour.
i Invariants and contracts preserved? Yes. The wait only reads (SELECT, 4lw srvr) and mutates no cluster state; the socket closes in a finally. It is wall-clock bounded (time.monotonic(), 60s) with time.sleep(0.2) between polls, so it cannot hang the suite and does not busy-hammer the server. On timeout it raises with both zxids and the causal explanation rather than degrading into the uninformative original assertion.

Also: no no-parallel (the helper only reads and adds no global state), no no-flaky-check, and
the fixed test is green over sequential runs (50/50 on the previous revision, 10/10 re-run on this one, with 0 occurrences of the target signature, 0 ValueError, and 0 spurious catch-up timeouts). pytest --count was deliberately not used for that
number: this test hardcodes count()==1/count()==2 against a module-scoped fixture, which already
fails on unmodified master under --count 3 with an unrelated assert '2\n' == '1\n'.

@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

cc @antonio2368, could you review this? It is a test-only de-flake: since c39cac20ff8 a Keeper refuses a reconnecting client whose last_zxid_seen exceeds that host's applied zxid, so a node reconnecting while zoo1 is still applying the log tail is demoted to zoo2 and, because in_order never arms ZKReconnect, stays there. The test now waits for zoo1 to catch up before asserting re-convergence.

@PedroTadim PedroTadim self-assigned this Aug 9, 2026
@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Aug 9, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3942e36]

Summary: ✅


AI Review

Summary

This PR de-flakes test_fallback_session by waiting for zoo1 to catch up to the clients' observed zxid before forcing them off zoo3, and it also fixes the helper-side 4lw partial-read bug by reusing send_4lw_cmd. The helper fix is correct, but the test still leaves the same reconnect race reachable, so I do not think the fallback assertion is reliably restored yet.

Findings

⚠️ Majors

  • [tests/integration/test_zookeeper_fallback_session/test.py:111-117] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/114055#issuecomment-5232843069] wait_zk_node_caught_up only proves that zoo1 had caught up to a sampled last_zxid_seen while the sessions were still alive on zoo3. Between this return and the later forced reconnect, those sessions can still process a heartbeat from zoo3; heartbeat responses carry the current commit_zxid, ZooKeeperImpl stores that into last_zxid_seen, and startNewSession copies the newer watermark into the reconnect handshake. If zoo1 is still one zxid behind at that moment, Keeper refuses the session and the node falls back to zoo2 exactly as before, so the change narrows the race instead of removing the flake.
    Suggested fix: add a barrier that prevents the sessions from observing newer zxids before reconnect, or fix the in_order reconnection path itself instead of relying on a sampled watermark in the test.
Final Verdict

Needs another fix before merge; the partial-read regression is fixed, but the new wait does not make the final zoo1 assertion reliable.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 9, 2026
@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - d2830d3

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens.

Check / test Reason Owner / fixing PR
Build (arm_release) / Post Hooks build-profile telemetry INSERT to the CI logs cluster; NON-GATING, the check itself concluded success #113409 (ours, merged)

No test-level failure on this head: all 32 executed checks concluded success (0 running, Finish Workflow success).

Session id: cron:our-pr-ci-monitor:20260809-230000

Two defects in the wait helper added by this PR, both of which can make the
de-flake itself flaky.

get_zk_applied_zxid hand-rolled the 4lw exchange and read the reply with a
single recv(). A 4lw reply is not guaranteed to arrive in one segment, which
keeper_utils.send_4lw_cmd already documents and handles by reading until the
peer closes. A short read would leave the payload without its "Zxid:" line,
the oracle would report None, and the wait would burn its whole timeout while
zoo1 was in fact caught up. Rather than duplicating the read loop, reuse
send_4lw_cmd: it only needed to accept a bare container name, since this
fixture's Keepers are addressed by name and not by instance. All existing
callers pass instances, for which getattr returns the same node.name as
before, so their behaviour is unchanged.

The success branch also required two consecutive satisfying samples. That
requirement cannot add a guarantee: the clients are read after zk_node, so
client_zxid is never older than applied, and a Keeper's committed zxid only
grows (KeeperStorageImpl throws on any attempt to commit a smaller one), so a
pair that satisfies applied >= client_zxid keeps satisfying it. What the
requirement did add was a failure mode, because the counter resets whenever a
sample does not satisfy the condition: satisfying samples interleaved with a
freshly advanced client watermark never reach two in a row, and the helper
times out after 60s. It then printed the last sample, so the report could
state that zoo1 had applied N while the clients had seen N, i.e. contradict
itself. It fired that way on this PR's own head in CI. Returning on the first
satisfying pair removes both the false timeout and the ambiguous message.

Verified against a live three-Keeper fixture: the srvr reply parses to an
integer for all three Keepers over the bare-name path, the applied zxid is
monotonic across an insert (99 -> 113), and the wait returns in 0.35s.
@PedroTadim
PedroTadim added this pull request to the merge queue Aug 12, 2026
Merged via the queue into ClickHouse:master with commit 5582ee1 Aug 12, 2026
180 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 12, 2026
@groeneai groeneai added the groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect label Aug 19, 2026
pull Bot pushed a commit to Mu-L/ClickHouse that referenced this pull request Sep 4, 2026
The test breaks the nodes' zoo3 session and asserts that `in_order` balancing
puts them back on zoo1. A Keeper refuses a reconnecting client whose
`last_zxid_seen` exceeds its own applied zxid
(`KeeperTCPHandler::receiveHandshake`), and `hasOptimalNode` returns false for
`IN_ORDER`, so `may_benefit_from_reconnecting` is false, the `ZKReconnect` task
is never created and the demotion is permanent for the rest of the test. If zoo1
is behind at the instant the nodes reconnect, they land on zoo2 and stay there.

ClickHouse#114055 sampled "zoo1 has caught up" before the cut. That cannot be made to
work: while the nodes are still connected to zoo3 they keep advancing the very
quantity zoo1 must overtake, because `Coordination::ZooKeeper::receiveEvent`
stores every response header with `zxid > 0` into `last_zxid_seen` and does so
before the `PING_XID` branch, so a plain heartbeat raises it too. Its own check
is also unreliable on its own terms: it reads the Keeper first and the clients
second, so any commit landing between the two reads fails the comparison.
Measured on a healthy cluster with no interference, taking those two reads 250
times at the check's own cadence and adding a third read of the Keeper after the
client read: 47 rounds (18.8%) would have failed, all 47 with
`applied_before < client <= applied_after`, zero real lags, and the gap always
exactly 1 - the `applied 214 / seen 215` shape reported in CI.

Remove the movement instead of sampling it. The second partition now cuts the
nodes off every Keeper and finalizes their sessions with
`SYSTEM RECONNECT ZOOKEEPER`, which joins the receiving thread so the watermark
can no longer advance; zoo3's own applied zxid is then read once as a fixed
target, which bounds every zxid the nodes can have seen because they are
asserted to be on zoo3 immediately above; and the wait is retargeted to that
constant. The final assertion moves out of the block so all three Keepers are
reachable when the nodes reconnect, which strengthens it: previously zoo3 was
still excluded, so `in_order` only had to prefer zoo1 over zoo2.

`get_max_client_zxid` is deleted. A disconnected client has no row in
`system.zookeeper_connection`, which is exactly why the target now comes from
the Keeper side, and the metric that does survive a session loss,
`ZooKeeperClientLastZXIDSeen`, needs `SYSTEM RELOAD ASYNCHRONOUS METRICS`,
measured at 9 to 16 seconds per node while ZooKeeper is unreachable.

Validated by cutting zoo1's Raft link inside its own container after moving Raft
leadership away, so zoo1 keeps its container, its DNS entry and its client
listener but stops applying. Under that forcing the current test fails 4 of 4
runs with `assert 'zoo2' == 'zoo1'` and the verbatim refusal in zoo1's log,
while the fixed test passes under identical parameters, with
`ZooKeeperClientLastZXIDSeen` read twice a second apart after the finalize loop
and unchanged on all three nodes and below the target. Weakening the cut back to
zoo3 alone makes the fixed test fail again. 30 of 30 sequential unforced runs
pass, 33 to 42 seconds each against 54 seconds before.

Related: ClickHouse#66966
Related: ClickHouse#114055

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

Labels

can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect 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.

3 participants