Repository navigation
fix(soak): the prober grade reads raw counters and gates the unpinned-cluster counter; churn.sh stops on TERM and leaves no orphan (#1390, #1418, #1419, #1423) - #1458
Merged
Conversation
…-cluster counter; churn.sh stops on TERM and leaves no orphan (#1390, #1418, #1419, #1423) prober-grade.sh (#1390, #1423). The soak grade read increase(aether_probe_requests_total{result!="success"}[8h]), which cannot count the sample that creates a series: 37 reported for a run whose raw counters read 40. The new script takes the value of every series at the window's start (absent = 0) and every raw sample in the window, and sums the steps: a series born in the window is counted whole, a counter reset is counted across and printed, a prober pod replaced mid-run is counted up to its last sample. It prints the window, the four queries, totals, every non-success by tier, result and source node, and one verdict line. The same computation over aether_agent_identity_cluster_unpinned_total is the new unpinned-cluster gate: any increase fails, no series is UNPROVEN. The Prometheus endpoint is a parameter (a URL, or a Service through the API server); there is no default. A log file or a log endpoint adds the cross-check against AETHER_PROBE_FAIL lines. churn.sh (#1419). It slept in the foreground, and bash runs a trap only when the foreground child has ended: a TERM took effect at the next roll, up to 12 minutes later, 90 in the no-roll window. It did not have the sleep-in-background pattern of the old watchdog, but it left other things: a queued RSS sampler survived a stop, each uds-csi step left its `kubectl get pods -w` running even on a run that finished (the kill reached the subshell around it), and a TERM in the pre-flight, in a TRIPLE or in the new-SA node listing left a kubectl call behind. It now waits without a child process (lib-wait.sh, shared with restart-watch.sh and sample-proxy-rss.sh), and a stop is one pass: the cluster first (SHRINK, new-SA objects), then its own children, then exit 143. What it does to the cluster, and when, is unchanged: every kubectl call of a dry run and the second it is made at are held against a schedule written by the script as it was. #1418. No `$(date)` is left in the log line, the waits or the watchdog's sample loop: the time is printf's %(...)T. bash can still drop a TERM that lands in the `$(...)` around a kubectl call, so the README says to send TERM until the script has exited. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🟡 Changes recommended
Log-boundary accounting, exit-status precedence, and bounded child cleanup can produce incorrect grading or leave processes running.
3 open findings
What changed in this PR
Adds reliable raw-counter grading and improves soak-process shutdown behavior.
Changes:
- Adds prober and unpinned-cluster grading from raw Prometheus samples.
- Introduces shared interruptible wait utilities.
- Expands harness coverage for grading, churn schedules, and termination.
| File | Description |
|---|---|
e2e/soak/BUILD.bazel |
Registers scripts, fixtures, and expanded harness timeout. |
e2e/soak/README.md |
Documents grading and shutdown behavior. |
e2e/soak/churn.sh |
Adds interruptible waits and child cleanup. |
e2e/soak/harness_test.sh |
Tests grading, schedules, and termination. |
e2e/soak/lib-wait.sh |
Provides fork-free clock and wait helpers. |
e2e/soak/prober-grade.sh |
Implements raw-counter grading and log cross-checks. |
e2e/soak/restart-watch.sh |
Uses shared wait and timestamp helpers. |
e2e/soak/sample-proxy-rss.sh |
Adds signal handling and safer subprocess waits. |
e2e/soak/testdata/churn/schedule.tsv |
Captures the expected churn schedule. |
e2e/soak/testdata/prober-grade/born/logs.jsonl |
Adds VictoriaLogs response fixture. |
e2e/soak/testdata/prober-grade/born/probe.start.json |
Adds born-series baseline fixture. |
e2e/soak/testdata/prober-grade/born/probe.window.json |
Adds born-series window fixture. |
e2e/soak/testdata/prober-grade/born/prober.log |
Adds failure-log fixture. |
e2e/soak/testdata/prober-grade/born/unpinned.start.json |
Adds unpinned baseline fixture. |
e2e/soak/testdata/prober-grade/born/unpinned.window.json |
Adds unpinned window fixture. |
e2e/soak/testdata/prober-grade/clean/probe.start.json |
Adds clean baseline fixture. |
e2e/soak/testdata/prober-grade/clean/probe.window.json |
Adds clean window fixture. |
e2e/soak/testdata/prober-grade/clean/unpinned.start.json |
Adds clean unpinned baseline. |
e2e/soak/testdata/prober-grade/clean/unpinned.window.json |
Adds clean unpinned window. |
e2e/soak/testdata/prober-grade/empty/probe.start.json |
Adds absent-metric baseline fixture. |
e2e/soak/testdata/prober-grade/empty/probe.window.json |
Adds absent-metric window fixture. |
e2e/soak/testdata/prober-grade/empty/unpinned.start.json |
Adds absent-unpinned baseline. |
e2e/soak/testdata/prober-grade/empty/unpinned.window.json |
Adds absent-unpinned window. |
e2e/soak/testdata/prober-grade/reset/probe.start.json |
Adds reset baseline fixture. |
e2e/soak/testdata/prober-grade/reset/probe.window.json |
Adds reset and replacement fixture. |
e2e/soak/testdata/prober-grade/reset/unpinned.start.json |
Adds reset unpinned baseline. |
e2e/soak/testdata/prober-grade/reset/unpinned.window.json |
Adds born unpinned-counter fixture. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…s ahead of a child, and a boundary `suppressed` summary is not a mismatch The `test` job failed on this branch with `churn term sweep: ... udscsi, TERM before command 277, exit 0; no TERM was sent`. The sweep sent its TERM before "the k-th command" of a traced run. The uds-csi step polls for another process and goes round a loop a number of times that depends on the machine (271 and 283 commands in two runs on one machine), so the 277th command of the trace was past the end of a shorter run. A TERM point is now the code point itself: line, command and whether an RSS sampler has been queued, the first time the main shell comes to it. A traced point that a run does not come to again (three tries) is listed apart and bounded, instead of read as a TERM that was mishandled. From review: - `stop_children` gave up after 20 s, said `left behind` and let the driver exit ahead of a child that was still running, which is what the stop says it never does. It now returns only when there is no child left, and names what it is waiting for in the log after 20 s, once. Test: the TRIPLE's three rolls made to hang past that. - A `suppressed` summary's `t` is when its window was closed, up to two minutes after the failures it counts. One closed within two minutes after either end of the run's window is now a boundary summary: printed, left out of the sum, and the row is UNPROVEN when the counters lie between the two sums. `--logs-url` asks for two minutes past the end. - `harness_test` keeps its `moderate` timeout, as the description said. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…the hung rolls return Without it the test passed on a driver that exited at its bound: the rolls returned 200 ms later and nothing was left by the time the test looked. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
From review: with `prober=FAIL`, a log MISMATCH or UNPROVEN still left the script at exit 1, as if the counters' number were a list to attribute. Exit 2 now comes first; exit 1 is a FAIL with everything else proven. The script's header also said a failed probe's destination "is on the AETHER_PROBE_FAIL line". That is #1391, which is not in this change: it now says it is found through the access logs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
… replicas From review: `SHRINK_PREV` was set after the `scale --replicas=0` call. A TERM that arrived during the call was taken when it returned, with the scale applied and nothing recorded to restore: the driver exited 143 and left the target at zero. It is now set before the call. A scale-down that fails keeps it set as well. A call that timed out may have been applied, so the abort restores the previous count; restoring a value that is already there changes nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
From review: only the log timestamp and the waits were converted. A step still reads kubectl output and its deadlines through one while it runs. Co-Authored-By: Claude Opus 5.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 #1390
Closes #1423
Closes #1419
Closes #1418
This is the harness half of a six-issue task. The six did not fit one reviewable pull request, so the prober's failure line (#1391) and the test workloads' stdout (#1395) are in a second one, #1461. The two do not depend on each other.
What changes
e2e/soak/prober-grade.sh(new): the prober grade, from raw counters (#1390).e2e/soak/prober-grade.sh --dir <run dir> --prometheus <URL>(or--prometheus-service <ns>/<svc>:<port>, through the API server with the run's own context). The endpoint is a parameter and has no default.churn.log, the window 8 h. An e2e run has no churn log:T_LOAD+DURATION_Sofrun.env.metric[<window>s]at the window's end, which returns the raw samples.PROBER verdict=line and oneVERDICTline. Exit 0 pass, 1 something to attribute, 2 unproven; 2 comes first, so aFAILbeside a count that cannot be trusted is exit 2.--logs-fileor--logs-urladds the cross-check againstAETHER_PROBE_FAILlines (detail lines plus thesuppressedcounts). Asuppressedsummary carries the time its minute was closed, up to two minutes after the failures it counts; one closed within two minutes after either end of the window is printed as a boundary summary, left out of the sum, and the row isUNPROVENwhen the counters lie between the two sums.The unpinned-cluster gate (#1423), in the same grade and by the same computation:
aether_agent_identity_cluster_unpinned_totalmust not move.UNPINNED verdict=is its own line. The counter is seeded at zero, so no series at all isUNPROVEN.churn.shstops on TERM and leaves nothing (#1419). It did not have thesleep & / PID / waitpattern. It had a foregroundsleep, and bash runs a trap only when the foreground child has ended, so a TERM took effect at the next roll: up to 12 minutes later, 90 in the no-roll window. Looking for what a stop leaves found more:sleependedread -ton a private fifo, no childsleep 1680, then around the sampler)kubectl get pods -wexec'd, so the kill reaches kubectlmapfile < <(...)is not waited for)A stop is now one pass: restore the SHRINK and delete the new-SA objects, stop the children, exit 143. It never exits ahead of a child: a call that does not return holds the driver, and after 20 s the log names what it is waiting for.
lib-wait.sh(new): the clock and the wait without a child process, shared bychurn.sh,restart-watch.shandsample-proxy-rss.sh.restart-watch.sh's own copy (from #1417) moved there unchanged.#1418. The timestamps of
churn.sh's log and of the watchdog, and the waits, no longer use a command substitution (printf '%(…)T'). The kubectl calls still do, so the README now says: send TERM until the script has exited.What it does to a cluster is unchanged
The before/after of a dry run, whole schedule, fake kubectl, on a clock the test controls:
The call-list line was measured again at the end of the review, by running the test's dry run once with
origin/main'schurn.shand once with this branch's and comparing both with the committed file; the log-line and sampler counts are from the first measurement. The "before" call list is committed astestdata/churn/schedule.tsvand the test holds every later run against it. One difference that is not in the schedule: the old run ended with twokubectl get pods -wstill running, the new one with none.One behaviour that does change:
SOAK_SHRINK_SECONDSandSOAK_PROXY_RSS_DELAYwere arguments tosleepand so also took90sor1.5. They are now clock arithmetic, and anything but whole seconds is refused at pre-flight (exit 2, before T0).Evidence
Measured:
TOTAL tier=mesh_dns result=timeout count=40, twoBORNlines withfirst=2andfirst=1(21 + 19). That is the 40 of the issue, and 37 is what is left when the two creating samples are not counted. The same run's unpinned counter reads 2,594 over five nodes with two resets per node at the two agent rolls. That run was on a chart from before fix(agent): the unpinned-cluster report leaves out the plaintext UDP floor (#1393) #1421, so that number is the old noise, not a finding.//e2e/soak:harness_test:bornfixture, last-minus-first-sample (howincrease()counts) reads 37, the script 40;x - x offset 8hdrops both series;origin/main'schurn.sh, the new tests fail: TERM while it waits for the first roll gives exit 137 after the test's 10 s timeout withsleep 720left; a finished dry run leaves two watches; the sweep finds the watch left at every boundary of the uds-csi step; every pre-flight call and each TRIPLE roll is "NOT waited for";--new-sa-once,--uds-csi-once, with and without a queued sampler) and during each of 65 kubectl calls: exit 143, nothing left in the session, the clock does not move on.exec'd; nostop_children; a TRIPLE roll that does not ignore TERM; foregroundsleepagain; the watch ask … &again; themapfileprocess substitution again; no trap in the sampler; one TERM to a child instead of until it is gone; no early trap; a roll moved by one minute (caught by the schedule). Nine mutations ofprober-grade.sh, each caught (absent series started from its first sample; reset not handled; baseline ignored; no series read as a pass; a failed query read as no data; log lines outside the window;suppressednot added; an unpinned increase passing; the window not checked against now).TZ=UTC printf '%(%FT%TZ)T'gives UTC with the environment's zone three hours off on bash 4.2.53, 4.4.23 and 5.2.21 (containers for the first two). The scripts state bash 4.2+.bazel test //e2e/... //scripts/... //bazel/actionlint:all,bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...,make format-check,scripts/check-shell-lint.sh: all pass. The harness test takes about 50 s on a 20-core machine and 85 to 92 s pinned to two cores (five runs in a row with the final code, all green). Its Bazel timeout staysmoderate(300 s). After the review changes: 45 to 48 s under Bazel, 72 s pinned to four cores, 359 assertions.The failed
testcheck, and the reviewThe first run's
testjob failed for a real reason, in this change's own new test (ciis the aggregate and failed only becausetestdid):churn term sweep: … udscsi, TERM before command 277, exit 0; no TERM was sent. The sweep sent its TERM before "the k-th command" of a traced run. The uds-csi step polls for another process and goes round a loop a number of times that depends on the machine (271 and 283 commands in two runs on one machine), so the 277th command of the trace was past the end of a shorter run. A TERM point is now the code point itself (line, command, and whether a sampler has been queued). A traced point that a run does not come to again in three tries is listed apart and bounded at 12; in every run since, there were none.From review, each with a test that fails without the fix:
stop_childrengave up after 20 s and let the driver exit ahead of a child. It now returns only when no child is left. Test: the TRIPLE's three rolls are made to hang until the driver says it is waiting; the fake then checks the driver is still there. With the bound put back:the driver was GONE when the rolls returned.suppressedsummary (above). With the old selection put back, six assertions fail.logs=MISMATCH.moderateagain, as this description said.Inferred, not measured:
kubectl get pods -wwas left running by the old driver on a real cluster. The test shows the mechanism with a fake kubectl (killing$!ofk … &kills a bash subshell, not its child); I did not look for leftover processes from a past soak.stop_childrensays what it is waiting for is a choice, not a measurement.Not verified:
--logs-urlagainst a live log store. The request shape (/select/logsql/querywithquery,start,end) is from VictoriaLogs' documentation as I remember it; only--logs-fileand a canned response are tested.--prometheus URLagainst a live endpoint (the--prometheus-serviceform is the one that was run for real).🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr