Skip to content

proxy-supervisor: SIGTERM with no successor now exits in ~2 s without waiting for the surge replacement — pod delete/drain/eviction costs ~8 s of node data path (regression from #785) #795

Closed

Description

@bpalermo

Found by the rev214 deploy validation (2026-09-16, record validate-rev214.md, memory project_deploy_20260916_rev214.md).

Before #785 (measured 2026-09-15 on rev213): kubectl delete pod aether-proxy-* took 21–23 s, the old Envoy kept serving until the DaemonSet's surge replacement hot-restarted it, and the prober saw zero errors on that node. That was the accidental effect of the #771 bug: the broken probe always chose the wait-for-successor branch.

After #785 (rev214, 2 samples on worker-04/05): the probe works, the admin reports LIVE at our own epoch, so handleShutdown takes the drain branch and calls s.shutdown() (bare SIGTERM to Envoy — Envoy does not drain listeners on SIGTERM). Termination 1.5–2.3 s, the replacement logs no live predecessor; starting fresh at epoch 0, and the node has no Envoy for 7.95 s / 8.11 s → 130 / 126 prober connection_errors and AetherProberLivenessErrors pages (CRITICAL 03:02:55→03:07:55Z). Same path as node drain, eviction and preemption.

Root cause of the design: for a DaemonSet with maxSurge and a transparent-capture node proxy, "no handoff in progress" on SIGTERM does not mean "nobody is coming" — the replacement is created within ~1 s and hot-restarts us. The right policy is the pre-fix behaviour made deliberate and bounded: on SIGTERM, if no successor is live yet, wait for one up to the grace budget (#785's --termination-grace-derived budget, 155 s at the chart default), hand off when it arrives, and only fall back to a real graceful drain (admin /drain_listeners?graceful + --drain-time, then SIGTERM) when the budget expires (node shutdown, scale-down, DaemonSet delete — no successor will ever come).

Fix: in agent/internal/proxy/hotrestart/supervisor.go handleShutdown: drain-immediately only when the successor wait is impossible (no surge configured / explicit flag), otherwise wait-bounded-then-drain; the fallback drain must be graceful, not a bare SIGTERM (fix s.shutdown() or add a drainThenShutdown()). Keep #785's detached probe (it is still needed to detect a genuine mid-handoff and to log the state). Unit tests: successor arrives inside the budget → handoff, zero drain; no successor → graceful drain at the bound. Cluster validation: delete-pod on two workers must return to ≤ rev213's numbers (≈22 s termination, 0 prober errors), and a kubectl drain-style eviction should behave the same.

Also seen: aether_supervisor_drain_duration_* never reaches Prometheus and the log phrase "closing and draining listeners" does not exist in the source — the drain path has no observability; add a counter/histogram and an INFO line in the same PR.

Refs #771, #785, #772.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Activity

  1. added
    bug
    on Sep 16, 2026
  2. bpalermo commented on Sep 16, 2026

    @bpalermo
    OwnerAuthor

    Cluster validation: PASS — deployed as rev215 and verified on talos-main

    aether 0.92.22-0aa7107f53fe2f0c9b6c6eed59f15cc00e7896ae (PR #797) deployed 2026-09-16 04:42:33Z, helm list appVersion asserted. Full record: validate-rev215.md.

    The acceptance criterion in this issue — "delete-pod on two workers must return to ≤ rev213's numbers (≈22 s termination, 0 prober errors), and a kubectl drain-style eviction should behave the same" — is met on three samples, including a genuine eviction.

    Termination samples (kubectl logs -f on the proxy container started before each delete)

    # node path termination branch counter Envoy-absent overlap prober errors
    1 worker-04 kubectl delete pod 23.12 s successor_wait=1 0 s 16.69 s 0
    2 worker-05 kubectl delete pod 21.08 s successor_wait=1 0 s 15.99 s 0
    3 worker-02 real policy/v1 Eviction 21.89 s successor_wait=1 0 s 16.28 s 0
    — rev214 (broken) kubectl delete pod 2.27 / 1.55 s metric absent 7.95 / 8.11 s none 130 / 126
    — rev213 (accidental) kubectl delete pod 23.37 / 21.44 s metric absent 0 s — 0

    rev213's timings are restored to within 0.3 s and its zero data-plane cost exactly — but now deliberately, off the bounded successor_wait branch, instead of by accident off a broken probe.

    Log sequence, observed verbatim 3/3 (sample 1 shown):

    04:48:44.345 INFO supervisor.go:481  "waiting for a successor before draining"
                       epoch=1 successorWaitBudget=155000000000 drainTime=10000000000
    04:48:50.546 info [main] closing and draining listeners      <- successor took the listeners
    04:49:05.485 warning [main] caught ENVOY_SIGTERM
    04:49:05.814 info [main] exiting
    04:49:05.914 INFO supervisor.go:970  "reaped envoy epoch" epoch=1
    04:49:05.914 INFO supervisor.go:1058 "envoy epoch terminated by successor" epoch=1
    04:49:05.914 INFO supervisor.go:486  "successor took over during shutdown wait" epoch=1 midHandoff=false
    

    The replacement logs live predecessor confirmed; starting cross-pod hot restart (predecessorEpoch=1 → startEpoch=2) at 04:48:48.94 and initializing epoch 2 at 04:48:49.12 — 16.69 s before the old epoch exits. rev214's no live predecessor; starting fresh at epoch 0 is gone. The node has a serving Envoy at every instant.

    kubectl drain --ignore-daemonsets is unusable here (it ignores DaemonSet pods), so sample 3 POSTed the subresource directly — kubectl create --raw ".../pods/aether-proxy-z84dv/eviction" → {"status":"Success","code":201} — which is the real drain/evict/preempt path this issue is about. Identical behaviour.

    Seeded branch counter (the #717 ask)

    aether_supervisor_shutdown_branch_total — 20 series present and equal to 0 immediately after the roll: all four values {handoff, successor_wait, drain_fallback, child_dead} × all five nodes. On rev214 the same query returned no data at all. It is a per-generation counter, so the pre-SIGTERM value is read with max_over_time(...[Nm]); that read gives successor_wait=1 on each deleted pod's node and 0 for the other three branches.

    Fleet SLI over the whole session (04:42:07Z → 05:04:23Z)

    • liveness 0 / 33,300 = 0.000 %
    • mesh_dns 0 / 66,600 = 0.000 %, dns_error/dns_nxdomain/dns_timeout zero on both targets (authoritative *.aether.internal and kube-dns-forwarded *.svc.cluster.local)
    • 0 restarts, 0 taints, 0 ERROR lines in any component, 0 xDS NACKs, Transient cross-service mTLS identity mis-binding during concurrent proxy-restart + service roll (failed closed) #638 mismatch 0, UDS ledger 0 FAIL
    • Zero alerts fired. AetherProberLivenessErrors never even went pending (on rev214 it paged CRITICAL off this exact test). #alerts has had no traffic since the rev214 resolve at 03:07:55Z.
    • Measurement plane valid throughout: collector receiver_refused_* = 0, exporter_send_failed_* byte-identical start to finish, all five nodes present in every gauge.

    The roll itself was also hitless (0 prober errors over the bracket), 5/5 cross-pod hot restarts in 16.0–17.2 s, and completed in 3 m 21 s vs rev214's 15 m 20 s.

    Two things this run did not prove

    1. drain_fallback was never exercised on-cluster. All three samples took successor_wait; drain_fallback and child_dead read 0 on every node. So aether_supervisor_drain_duration_* still does not reach Prometheus — not because it is broken, but because no drain happened. The graceful-drain fallback and its histogram rest on fix(supervisor): on SIGTERM wait (bounded) for the surge successor before draining; graceful drain fallback (#795) #797's unit tests alone. Exercising it needs a case where no successor can come (scale the DaemonSet to 0, cordon+delete, or --shutdown-drain-immediately, which is correctly absent from the live argv). Worth a follow-up.
    2. No load / no churn / no k6, and steady state was only 10 min. http_req_failed is not measured and this is not a soak PASS.

    Separately: #796 did not recur, but it is not fixed — worker-03 is unchanged at 3345 m / 84 % CPU requests with clj-grpc-soak/grpc-jvm resident; the edge surge replica simply landed on worker-04/02 this time. Scheduler luck. No workaround was needed or applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions