Skip to content

fix(quic): immediate drain + 8 s h3 twin idle so no source h3 connection outlives a hot-restart parent (#1054); skipParentStats default off now that #1060 fixes the deadlock - #1063

Merged
bpalermo merged 1 commit into
mainfrom
fix/1054-h3-drain-goaway-config
Sep 28, 2026

Conversation

@bpalermo

@bpalermo bpalermo commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Part A: #1054, source h3 requests die on a stateless reset at a destination's roll

Mechanism and plan: #1054 (last comment). A source's h3 connection to the destination's draining hot-restart parent is still open when the parent exits. The next packet on it reaches the child, which answers with a QUIC stateless reset. The token is FNV1a_128(CID), so parent and child mint the same one and the source accepts it. Two things kept such connections alive:

  • Under Envoy's default gradual drain strategy, the GOAWAY is a coin flip per response, so a connection can go the whole drain without one.
  • An idle connection gets no GOAWAY at all, and the h3 pool's 30 s idle timeout outlasts the 15 s parent-shutdown window.

1. Immediate drain (chart)

  • New value proxy.hotRestart.drainStrategy (immediate | gradual, default immediate).
  • It renders as --envoy-arg=--drain-strategy + --envoy-arg=<v> through the supervisor's existing extra-args path (buildEnvoyCmd, which also feeds envoy --mode validate).
  • The option exists at the pinned Envoy 726d7ac: source/server/options_impl.cc:164-167, a TCLAP ValueArg that accepts gradual|immediate and throws on anything else (:338-340). The chart therefore validates the value and fails the render on a typo (aether.proxy.drainStrategy), rather than letting every proxy pod crash-loop at rollout.
  • Effect: once the drain starts, every response carries GOAWAY, so a source's h3 pool stops using the parent on its next response.
  • Cost: the change is server-wide. Reconnections (h2 and h3) bunch at the start of the drain instead of spreading over drainTime, which means a burst of TLS/QUIC handshakes against the child. LDS listener drains and the pod-termination drain switch to immediate as well.

2. h3 twin idle timeout (agent + chart)

  • New agent flag --east-west-quic-idle-timeout (default 8s). It sets the pool idle timeout on the quic: twins only (config.Http3ProtocolOptions(idle) via proxy.QUICClusterFrom(..., idle); SnapshotCache.SetQUICIdleTimeout). h1/h2 and every other cluster keep UpstreamIdleTimeout (30 s).
  • The agent rejects values <= 0. Zero would render Envoy's 1 h default.
  • The chart fills the flag from agent.eastWestQuicIdleTimeout.
  • Enforcement choice: a chart-level check. The agent does not know the proxy's parent-shutdown time: it is another DaemonSet's value, passed only to the supervisor. So aether.agent.eastWestQuicIdleTimeout in _helpers.tpl parses both durations (whole ms/s/m/h components; anything else fails naming the value) and fails the render unless idle + 5s < proxy.hotRestart.parentShutdownTime. There is no silent constant.
  • Cost: a (source, destination) pair idle between 8 s and 30 s pays one extra QUIC handshake on its next request.

Risks

  • The immediate-drain reconnection burst described above lands on the child, and it also applies to non-hot-restart drains.
  • A request that is in flight at the moment the parent exits still dies, the same as on h2.
  • Lowering parentShutdownTime now requires lowering eastWestQuicIdleTimeout with it. The chart says so when it refuses to render.

Part B: flip the #1050 workaround default

Tests

  • //test/envoy_validate: TestQUICUpstreamsIdleOutBeforeAHotRestartParentExits runs over the fixture bytes Envoy validates. Every quic: twin carries 8 s, and every other cluster with HTTP protocol options carries 30 s. Anti-vacuity: at least 2 twins and at least 1 other cluster must be present.
  • //agent/internal/xds/cache: TestQUICTwinsCarryTheirOwnIdleTimeout covers the default (8 s) and a configured value (5 s) on twins, with the h2 base still at 30 s.
  • //agent/internal/xds/proxy checks that QUICClusterFrom applies the default and a custom idle.
  • //agent/internal/xds/config covers Http3ProtocolOptions(idle) for zero, negative and explicit values, and checks that the default stays below 30 s.
  • //agent/internal/cmd checks that the flag is registered, defaults to 8s, parses a Go duration and rejects eight, and that the validator rejects 0 and negative values.
  • Chart tests:
    • drain strategy: aether_proxy_drain_strategy_test (default immediate), _gradual_test, _invalid_test (fail)
    • idle timeout: aether_agent_quic_idle_timeout_test (8s), _override_test (20s with a 1m parent shutdown), _too_long_test (10s + 5s == 15s fails), _short_parent_test (parentShutdownTime 12s fails with the 8s default), _malformed_test
    • skipParentStats: aether_proxy_skip_parent_stats_off_test is now the default and pins absence positionally (--drain-strategy's value is followed directly by env:); aether_proxy_skip_parent_stats_test sets true and checks the arg renders.
  • Suites run: //charts/..., //agent/..., //test/envoy_validate:all and //test/mtlspool:all, plus --config=race on the four touched Go packages.
  • Lint: bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //... passes, and make format-check passes.
  • Chart 1.0.6 → 1.0.7.

Harness

e2e/eastwest-quic-hotrestart.sh has a new HR_MODE=sparse mode:

  • Per restart (default 10): HR_PRE s of light loops that end at the SIGHUP, then one request per (source, h3 destination) at T+2.
  • The harness then waits for the parent's shutting down due to child request. That is the exact text at the pin: hot_restarting_parent.cc:130.
  • It then sends a 200-request burst per source at concurrency 20.
  • Per restart it counts source-reporter access-log lines carrying Received_stateless_reset and lines carrying PEER_GOING_AWAY, plus client non-200s and hung requests.
  • The run header reports the live Envoy's --drain-strategy (from its argv) and the source Envoy's twin idle_timeout (from config_dump).

The mode needs two nodes. On one kind node the source and the destination are the same Envoy, whose client connections die with the parent, so the reset cannot happen there. This PR therefore adds:

  • EWQ_WORKER=1 in eastwest-quic.sh: adds a worker node, pins destinations to it and sources to the control plane, and untaints the control plane.
  • HR_QUIC_IDLE: patches the agent DaemonSet past the chart check. It is only for the red arm's 30 s, which the chart now refuses to render.
  • HR_FREEZE_PARENT_S / HR_FREEZE_AT: an optional forced fault, like WEDGE_FREEZE_S. It SIGSTOPs the parent just before the child's parent-shutdown timer fires and bursts into the freeze, which holds the production window open.

Folded in from the #1060 validation:

  • EWQ_LOCAL_PROXY=1 loads a locally built proxy image.
  • hotrestart-wedge.sh reads the per-pod status files before killing the load.

Kind red/green

Two nodes (EWQ_WORKER=1), 10 destination hot restarts per run.

arm settings (verified live) forced STATELESS_RESET PEER_GOING_AWAY client non-200
red gradual, twin idle 30s no 0 0 0
red gradual, twin idle 30s freeze 4s @t+14 1 (restart 3) 0 20 (19 freeze handshake timeouts)
green immediate, twin idle 8s no 0 every restart 0 0
green immediate, twin idle 8s freeze 4s @t+14 0 every restart 0 40 (all freeze handshake timeouts; 0 hung)
red   SPARSE RESTARTS=10 FREEZE_S=0 STATELESS_RESET=0 PEER_GOING_AWAY=0 CLIENT_NON200=0 DRAIN_STRATEGY=gradual TWIN_IDLE=[ 22 other 30s 4 quic 30s ]
red   SPARSE RESTARTS=10 FREEZE_S=4 STATELESS_RESET=1 PEER_GOING_AWAY=0 CLIENT_NON200=20 HUNG=0 HANDSHAKE_TIMEOUT=19 DRAIN_STRATEGY=gradual TWIN_IDLE=[ 22 other 30s 4 quic 30s ]
green SPARSE RESTARTS=10 FREEZE_S=0 STATELESS_RESET=0 PEER_GOING_AWAY=0 CLIENT_NON200=0 HUNG=0 HANDSHAKE_TIMEOUT=0 DRAIN_STRATEGY=immediate TWIN_IDLE=[ 22 other 30s 4 quic 8s ]
green SPARSE RESTARTS=10 FREEZE_S=4 STATELESS_RESET=0 PEER_GOING_AWAY=0 CLIENT_NON200=40 HUNG=0 HANDSHAKE_TIMEOUT=40 DRAIN_STRATEGY=immediate TWIN_IDLE=[ 22 other 30s 4 quic 8s ]

Red barely reproduces on kind:

  • Unforced, the red arm saw no stateless reset in 10 restarts.
  • With the forced freeze it saw 1 in 10.
  • The window is the few milliseconds between the child unpausing its inherited UDP listeners and the parent's workers stopping. After drainTime, a gradual drain also GOAWAYs every response, so only the first request on a connection left idle since T+2 can land in that window.
  • The 503 URX,UF … QUIC_NETWORK_IDLE_TIMEOUT lines in the forced runs are new handshakes that cannot complete while the parent is stopped and the child is still paused. That is a freeze artifact, present in both arms and not gated.
  • So green's zeros are consistent with the fix, but on kind they are weak evidence. The per-roll soak gate below is the real proof.

e2e/hotrestart-wedge.sh with the new defaults (single node, immediate drain, skipParentStats off, WEDGE_FREEZE_S=6):

WEDGES=0 RESTARTS=5 FREEZE_S=6 SKIP_PARENT_STATS=no

The kind clusters were deleted afterwards and the kube context was restored.

Soak gate and runbook

Not in this PR

The carried Envoy patch from the issue plan (step 2: HTTP/3 GOAWAY pushed from onDrain, which would let the idle cut go back to 30 s) is a separate change.

Refs #1054 (closes on the talos per-roll gate: 0 Received_stateless_reset across the e2e proxy rolls)

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…ion outlives a hot-restart parent (#1054); skipParentStats default off now that #1060 fixes the deadlock

- chart: proxy.hotRestart.drainStrategy (immediate|gradual, default
  immediate) rendered as --envoy-arg=--drain-strategy <v>; validated.
- agent: --east-west-quic-idle-timeout (default 8s) sets the idle timeout
  on the quic: twins only; h1/h2 keep 30s. The chart fills it from
  agent.eastWestQuicIdleTimeout and fails the render unless
  idle + 5s < proxy.hotRestart.parentShutdownTime.
- chart: proxy.hotRestart.skipParentStats defaults to false (the carried
  #1060 patch fixes the deadlock); kept as an emergency switch.
- e2e: HR_MODE=sparse in eastwest-quic-hotrestart.sh (two nodes via
  EWQ_WORKER=1, optional forced parent freeze), EWQ_LOCAL_PROXY, wedge
  harness reads per-pod status files before killing load.
- docs: runbook section and soak gate for #1054.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 4c72e23 into main Sep 28, 2026
24 checks passed
@bpalermo
bpalermo deleted the fix/1054-h3-drain-goaway-config branch September 28, 2026 23:09
bpalermo added a commit that referenced this pull request Sep 29, 2026
Brings #979 up to date with 36 commits of main (demand-scoped twins #1020/#1032,
fresh-stream classifier #1033/#1035, dormant-pair ledger #1036/#1038, per-twin
EDS names #1012/#1029, the twin certificate gate #1051, the ODCDS always-answer
override, --east-west-quic-idle-timeout #1063, L4 stat keys #1043, access-log
timing #1048, the identity gate #1055, hot-restart knobs #1068 and the carried
Envoy patches) while keeping #979's intent: no allow-list, every destination in
the node's dependency set is QUIC-eligible.

Resolution:
- cache: quicServices / SetEastWestQUICServices removed. armsFor gives arms to
  every default, identity-ready, non-waypointed entry whose service is in the
  dependency set (the same rule recordQUICPair admits by, so no route names a
  twin the agent would refuse); twins stay demand-scoped. The
  destination_not_quic_enabled refusal/prune reason is gone.
- quicpairs: the dependency-set prune now waits for the pod set like the
  source prune does -- the allow-list used to force its destinations into the
  set, and without it the first snapshot after an agent restart dropped every
  restored pair (TestQUICDemandPairSurvivesAgentRestart was red).
- fan-out log: allow_listed_services dropped; observed_pairs and
  awaiting_client_cert kept.
- chart 1.0.12: eastWestQuicServices removed, eastWestQuicIdleTimeout and its
  parentShutdownTime check kept.
- e2e/eastwest-quic.sh: main's demand-scoped E1/E4c/E6 + #979's QUIC_DNS_SANS
  negative control; h2only/E3 removed; E6 dials quic-a and its idgate-* pairs
  are excluded from the driven-pair count. eastwest-quic-hotrestart.sh's h2
  control is now the weighted GAMMA split (the one h2-by-design path).
- tests, runbook, soak README, configuration.md, 038 rewritten for the
  unconditional state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.

1 participant