Skip to content

fix(e2e): abort the pressure harness on heap vs GOMEMLIMIT, narrow the FAIL criterion (#699) - #714

Merged
bpalermo merged 5 commits into
mainfrom
fix/699-pressure-heap-abort
Sep 5, 2026
Merged

bpalermo merged 5 commits into
mainfrom
fix/699-pressure-heap-abort

Conversation

@bpalermo

@bpalermo bpalermo commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Fixes #699. Harness-only change (e2e/pressure/); no product code touched.

1. Abort on heap vs GOMEMLIMIT, not RSS vs a hard-coded number

memory_limiter triggers on the Go heap. The four runs on 2026-09-05 measured refusal onset at heap 1,077–1,300 MiB while RSS at that same instant was 1,250–1,650 MiB — GC slack runs RSS 1.15–1.4× ahead of heap. The old fixed 1,500 MiB RSS ceiling therefore sat inside that band, and runs 2 and 3 aborted after shedding had engaged but before the 15 s poll saw it.

ceiling now on today's collector
heap (primary) 95% of GOMEMLIMIT, read off the live pod's env 1,556 MiB (of GOMEMLIMIT=1638MiB)
RSS (backstop) 90% of resources.limits.memory 1,843 MiB (of 2 Gi)

If GOMEMLIMIT is derived (valueFrom: resourceFieldRef) or absent, it falls back to the container memory limit and says so. The memory_limiter soft/hard thresholds are likewise derived from limit_percentage/spike_limit_percentage at run time rather than hard-coded, so resizing the o11y plane cannot silently invalidate them.

Reading the numbers without scrape lag

Counters and gauges are now read from the collector's own :8888/metrics, one kubectl port-forward per replica — the scrape lag was why the poll missed the onset.

⚠️ The deployed collector does not currently serve :8888. Its service.telemetry.metrics has only a periodic OTLP push reader (30 s interval), no pull reader, so nothing listens on 8888. --metrics-source auto (default) detects this, warns loudly, and falls back to Prometheus at a 15 s poll — which is honest but still 30–60 s stale. The README carries the exact GitOps snippet that opens the pull reader; once that lands the harness picks it up automatically and drops to a 5 s poll. --metrics-source collector forces it and exits 2 rather than silently degrading.

Metric names are matched tolerantly, with and without _total, across otelcol_processor_memory_limiter_refused_* (what the deployed 0.159.0 actually emits), otelcol_processor_refused_* and otelcol_receiver_refused_*. heap/RSS are the max across replicas (each is a per-process limit), refused counters the sum.

Also fixed while wiring this up: replica discovery reads the Deployment's own .spec.selector instead of app.kubernetes.io/name=opentelemetry-collector, which the single-replica otel-scraper Deployment shares — it would have added a bogus port-forward and folded a second process's counters into the sums.

2. FAIL narrowed to #662's signature

Run 4's agent came Ready in 16 s with 0 restarts and SPIRE resolved — #668 demonstrably held — yet the harness printed FAIL because the new pod logged one self-recovering client retry at ERROR (registrar.go:463 failed to start watch stream, retrying … context canceled, tracked separately in #700).

FAIL failed to create SPIRE Workload API source in the log
FAIL the container exited: restartCount > 0, a terminated previous container, or CrashLoopBackOff
FAIL resolved workload trust domain from SPIRE never logged
INFO every other ERROR line — printed (first 20), not gating the verdict

3. --dry-run

Resolves GOMEMLIMIT, the pod limits, the abort thresholds and the metrics source, runs the full read-only pre-flight, prints the plan and the current readings, and exits 0. Applies no Job, touches no agent.

4. README

Records the observed numbers so nobody re-derives them: heap trigger ≈ 1,126 MiB ≈ RSS 1,250–1,650 MiB, limiter caps RSS at ≤ 1,743 MiB on the 2 Gi pod, 0 collector restarts across four runs, 1–4 min from apply to shedding. Adds a new What counts as a FAIL section, and a risk-section warning that rate() over the prober SLI under-reads during shedding (12–18/s against a real 25/s) — that is export lag on cumulative counters that self-heal, not lost requests, and nothing should be graded off a rate() spanning the window.

Validation

The harness itself was not run against talos-main — it floods the shared collector, and the main session runs it once before tonight's soak.

  • shellcheck e2e/pressure/run.sh — clean; make format-check — clean.
  • --dry-run exercised against talos-main on two nodes: resolves GOMEMLIMIT=1638MiB → 1,556 MiB heap ceiling, 2 Gi → 1,843 MiB RSS backstop, discovers exactly the 2 real collector replicas, and correctly reports the :8888 fallback. No Job applied, no agent touched, no residue.
  • --metrics-source collector --dry-run exits 2 with a clear message while 8888 is closed.
  • parse_bytes and the exposition-format aggregator unit-tested against a synthetic /metrics fixture (1638MiB/2Gi/1.5GiB/bare bytes/bogus units; scientific-notation gauges; max-vs-sum; the _accepted_ decoy series correctly ignored) — the :8888 code path is validated even though the endpoint is not yet open.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 2 commits September 5, 2026 17:38
…e FAIL criterion (#699)

Four runs against talos-main on 2026-09-05 exposed two defects in the #662
collector-shedding harness.

1. The abort ceiling sat below the point the limiter actually engages.
   memory_limiter triggers on the Go heap, and refusal onset was measured at
   1,077-1,300MiB heap while RSS at that same instant was 1,250-1,650MiB (GC
   slack runs RSS 1.15-1.4x ahead). The fixed 1,500MiB RSS ceiling therefore
   landed inside that band: runs 2 and 3 aborted after shedding had engaged but
   before the poll observed it. The primary ceiling is now heap against
   GOMEMLIMIT (95%, read off the live pod's env, falling back to the container
   memory limit when it is derived), with RSS kept only as a cgroup-OOM backstop
   at 90% of the pod limit. Both are derived at run time instead of hard-coded,
   so a resize of the o11y plane cannot silently invalidate them; the soft/hard
   limiter thresholds are likewise derived from limit_percentage/spike_limit_percentage.

   The counters and gauges are now read from the collector's own :8888/metrics
   over one port-forward per replica, which removes the scrape lag that made the
   poll miss the onset. The deployed collector does not currently serve :8888 --
   its service.telemetry.metrics has only a periodic OTLP push reader -- so
   --metrics-source auto detects that, warns, and falls back to Prometheus at a
   15s poll; the README carries the GitOps snippet that opens the pull reader.
   Metric names are matched tolerantly across
   otelcol_processor_memory_limiter_refused_* (what 0.159.0 emits),
   otelcol_processor_refused_* and otelcol_receiver_refused_*.

   Collector replica discovery reads the Deployment's own .spec.selector: the
   otel-scraper Deployment shares app.kubernetes.io/name=opentelemetry-collector
   and would otherwise have folded a second process into the sums.

2. The FAIL criterion was broader than #662. Run 4's agent came Ready in 16s
   with 0 restarts and SPIRE resolved -- the #668 fix held -- but the harness
   printed FAIL over one self-recovering client retry logged at ERROR
   (`failed to start watch stream, retrying` / `context canceled`, tracked in
   #700). FAIL is now exactly #662's signature: `failed to create SPIRE Workload
   API source`, a container exit (restartCount > 0, a terminated previous
   container, or CrashLoopBackOff), or the trust-domain resolution never being
   logged. Every other ERROR line is listed as informational.

Also adds --dry-run, which resolves GOMEMLIMIT, the pod limits, the thresholds
and the metrics source, prints the plan and the current readings, and exits
without applying the Job or touching an agent.

The README now records the observed numbers so nobody re-derives them (heap
trigger ~1,126MiB = RSS 1,250-1,650MiB, limiter caps RSS at ~1,743MiB on the 2Gi
pod, 0 collector restarts across four runs) and warns that rate() over the
prober SLI under-reads during shedding (12-18/s against a real 25/s) because of
export lag on cumulative counters that self-heal -- not lost requests.

Validated: shellcheck clean, make format-check clean, --dry-run exercised
against talos-main on two nodes (resolves GOMEMLIMIT=1638MiB -> 1,556MiB heap
ceiling and 2Gi -> 1,843MiB RSS backstop), --metrics-source collector correctly
exits 2 while :8888 is closed, and parse_bytes/agg_samples unit-tested against a
synthetic exposition fixture. The harness itself was NOT run against the cluster.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo and others added 3 commits September 5, 2026 17:52
…eaches shedding (#699)

Two of two runs at 2 pods x rate 2 on 2026-09-05 timed out at 300s with the
collector heap at 10% of GOMEMLIMIT and zero refusals; every run that reached
shedding used 3 x 3. Corrects the arithmetic (144MiB/s aggregate, ~72MiB/s per
replica, ~70% of the limiter's spike frontier) and the observed numbers from the
fifth run (heap peak 1,497MiB = 91% of GOMEMLIMIT, RSS peak 1,766MiB, 0 restarts).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit cd45903 into main Sep 5, 2026
16 checks passed
@bpalermo
bpalermo deleted the fix/699-pressure-heap-abort branch September 5, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e2e/pressure: abort on heap vs GOMEMLIMIT (RSS ceiling sits below the limiter's real trigger) and narrow the FAIL criterion to #662's signature

1 participant