Repository navigation
fix(e2e): stop treating a failed etcd read as "the mirror expired" (#597) - #871
Merged
Merged
Conversation
) The replicator e2e went red on 2026-09-18 and 09-19 after sixteen consecutive green runs. 09-17 and 09-18 built the SAME commit (0459c2a) with opposite outcomes, so no bisect could have found it, and the two standing hypotheses -- an intermittent stall, or a 30s budget that is too tight -- both predict exactly that pattern. Neither is what happened. mirror_present() { docker exec ... etcdctl get --prefix ... --keys-only 2>/dev/null | grep -q . } Stderr is discarded and the pipeline's status is grep's, so a docker exec that could not start, or an etcdctl that timed out, produces no output and is INDISTINGUISHABLE from "the keys are gone". Step 3's expiry loop breaks on the first "gone", so one hiccup on a contended runner made the harness declare the mirror expired while it was still there -- and start its 30s stopwatch up to ~29s before the event it claims to measure. Reconstructed from the 09-18 logs, the mesh actually withdrew in ~150ms. - mirror_state() replaces it with three values: present / absent / READ FAILED. Read failures are loud on stderr, carry --command-timeout=5s, and can never mean "absent". Only a successful read that finds nothing may anchor the stopwatch. - The origin-data check had the same defect in a worse place: a failed read made it report "region's ORIGIN data vanished from its own etcd", a spurious hard failure. It now distinguishes the two. - Step 3 samples the client call at ~1s instead of 6x5s and prints AETHER_METRIC replicator_withdraw_seconds on EVERY run, pass or fail. The budget stays 30s; the cap is 120s, so a run that blows the budget still yields a number. A red run now says how far past it went, which separates the hypotheses on a single failure instead of needing twenty runs. Also fixes a vacuous gate in the same file. dump_failover_state() decided "Envoy STILL holds echo hosts" from `grep -i echo | head -40` over admin /clusters -- but /clusters prints ~15 config rows per cluster before any host row, and there are three echo clusters, so head -40 can never reach one. It printed that verdict on the 09-18 dump, which contains zero host rows. Now filtered to rows carrying an address. Verified by reproducing the bug rather than by inspection: MODE | old verdict | expiry loop would... present | present | keep waiting (correct) absent | ABSENT | ANCHOR THE STOPWATCH execfail | ABSENT | ANCHOR THE STOPWATCH <-- wrong timeout | ABSENT | ANCHOR THE STOPWATCH <-- wrong and mirror_state returns 0/1/2/2 on those same four inputs. The host-row filter returns 0 rows on a config-only dump and 3 on one with hosts, where the old filter returned 17 rows on the config-only dump -- i.e. fired the verdict on zero hosts. Deliberately does NOT widen the budget: measured end to end the path is ~150ms, so after this fix 30s should come down, not up. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #597.
It was never a flake in the sense everyone assumed
The replicator e2e went red on 09-18 and 09-19 after sixteen consecutive green runs. The decisive datum: 09-17 and 09-18 built the same commit
0459c2a4with opposite outcomes, so no bisect could ever have found it. Both standing hypotheses — an intermittent stall, and a 30 s budget that is too tight — predict exactly that pattern, which is why more observation could not separate them.Neither is the cause.
Stderr is discarded and the pipeline's status is grep's. A
docker execthat could not start, or anetcdctlthat timed out, produces no output — and is therefore indistinguishable from "the keys are gone". Step 3's expiry loop breaks on the first "gone", so a single hiccup on a contended runner (two kind clusters, 2× SPIRE, 2× etcd onubuntu-latest) made the harness declare the mirror expired while it was still there, and start its 30 s stopwatch up to ~29 s before the event it claims to measure.Reconstructed from the 09-18 logs, the mesh withdrew in ~150 ms. The harness was timing the wrong interval.
What changes
mirror_state()replaces the boolean with three values — present / absent / read failed. Read failures are loud on stderr, carry--command-timeout=5s, and can never mean "absent". Only a successful read that finds nothing may anchor the stopwatch.AETHER_METRIC replicator_withdraw_secondson every run, pass or fail. Budget stays 30 s; the cap is 120 s so a run that blows the budget still yields a number. A red run now says how far past it went — which discriminates the hypotheses on a single failure rather than needing a distribution over twenty runs.Also: a vacuous gate in the same file
dump_failover_state()concluded "Envoy STILL holds echo hosts" fromgrep -i echo | head -40over admin/clusters. But/clustersprints ~15 config rows per cluster before any host row, and there are three echo clusters — sohead -40can never reach one. It printed that verdict on the 09-18 dump, which contains zero host rows. The verdict was asserted on no evidence. Now filtered to rows carrying an address (::<ip>:<port>::).Verification — by reproducing the bug, not by inspection
The original implementation, run verbatim against stubbed failures:
mirror_state()returns0 / 1 / 2 / 2on those same four inputs.Host-row filter, both directions:
bash -nclean;bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //e2e:allpasses and does actually lint the target (Linting //e2e:e2e_shell with ShellCheck), which is not something I take for granted after #853.What this deliberately does not do
It does not widen the budget. Measured end to end the path is ~150 ms; after this fix 30 s should come down, not up. Only a correctly-anchored measurement landing repeatedly in the 20–35 s band would justify widening — and now we will have the numbers to tell.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr