Repository navigation
fix(quic): answer ODCDS for a known twin immediately and never absent — first use after an agent restart no longer trips Envoy's on-demand timeout (#1049) - #1051
Merged
Conversation
… — first use after an agent restart no longer trips Envoy's on-demand timeout (#1049) rev248 phase C: the agent published every twin within 10 ms of the need for it, but a twin names its source's SVID statically, and SPIRE delivered the new k6 pods' SVIDs 6.9-7.4 s after their CNI ADD. The twins warmed on SDS, the on_demand filter's 2 s timeout fired first: 428 x 503 NC. - An identity whose client certificate is not in the snapshot yet gets neither a selection arm nor a twin (its requests ride the warm h2 cluster); the certificate's snapshot carries arm, twin and CLA together. The fan-out line reports awaiting_client_cert. - A named CDS subscribe for a quic: twin the stream already received via the wildcard is answered with the twin (SnapshotCache.CreateDeltaWatch). go-control-plane stayed silent on it, Envoy's per-name ODCDS subscription hit its 15 s initial-fetch timeout and reported the twin missing (main-worker-03, 15:45:04.7). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This was referenced Sep 28, 2026
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
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.
Where the seconds went (rev248 phase C, from the agents' own logs)
The issue asked whether the twin was queued behind a full-snapshot rebuild or a debounce. It was not. Every agent published every twin within 10 ms of the need for it. The time was spent in Envoy, warming a twin whose client certificate did not exist yet.
These timelines come from
kubectl logsof the rev248 agent pods, which were still running. The proxy logs are from the issue.main-worker-02, first-use pair:
15:44:46.116k6 loader pod CNI ADD (server/pod.go:108). It is the node's first pod of SAaether-test/default. The agent opens its SVID subscription at15:44:46.130(spire/bridge.go:316).15:44:46.3the pod's inbound chains referencespiffe://aether.internal/ns/aether-test/sa/default, which is absent from the snapshot (inboundidentitybinding.go:235).15:44:49.996the proxy's ODCDS request forquic:svc-2…@aether-test/defaultarrives.onDeltaRequest(server/odcds.go:98) callsobserveQUICTwin(:108), which callsObserveQUICTwin(cache/quicpairs.go:76). The pair is admitted andgenerateSnapshotruns on its own goroutine (:83).15:44:50.006SetSnapshotwith the twin and its CLA (cache/snapshot.go:220). That is 10 ms after the request.snapshotMu(:41) was free, and the registry reload's slow part, the listing, holds no cache lock.QUICClusterFrom(proxy/egress.go:319) callsQUICUpstreamTransportSocket, which callssdsSecretConfig(clientSpiffeID)(proxy/transportsocket.go:308). That secret is still not in the snapshot, so Envoy keeps the twin warming on SDS.≈15:44:52.2theon_demandfilter's timeout fires (onDemandClusterTimeout = 2s,proxy/httpfilter.go:32). Result:503 NC.15:44:53.526SPIRE delivers the pod's first SVID (update=initial). The next snapshot carries the secret, the twin warms, and traffic flows. That is 7.4 s after the CNI ADD.main-worker-04 and main-worker-03, dormant pair:
15:44:45.995/46.101revives the dormant pairs (reviveDormantQUICPairsLocked,cache/quicpairs.go:326) andSetSnapshotruns at46.057/46.116, 5 ms later.15:44:52.990/53.431.main-worker-03
not found during on-demand discoveryat 15:45:04.7. The agent published no snapshot between 15:44:53.4 and 15:45:43, so this is not an absent answer from the snapshot. The sequence:XdstpOdcdsSubscriptionsManager,od_cds_api_impl.cc).createDeltaResponsein v0.14.0), so it sent nothing.onConfigUpdateFailedthen calledonFailure, which callednotifyMissingCluster(cm odcds: … not found) at 49.7 + 15.0 = 04.7.Any request still waiting on the name at that moment would have been failed as missing.
Fix
cache/quicpairs.go:260,splitByClientCertificate; used atcache/cluster.go:1081).SetSecrets, from the SPIRE bridge) carries the arm, the twin and its CLA together. No route ever points at a twin that cannot warm.east-west QUIC fan-outnow logsawaiting_client_cert=N.cache/odcds_resend.go:41,SnapshotCache.CreateDeltaWatch).quic:name the stream was already sent, the cache computes the response against a copy of the returned-version map with that name blanked. That is what go-control-plane itself does for a name unsubscribed from a wildcard. The twin goes out in the response to the subscribe.removed_resourcesentry.Subscriptioncontract requires.Tests (each seen red with the fix disabled, green with it)
cache/quic_cert_gate_test.go:TestQUICTwinAndArmWaitForTheSourceCertificate. Red: source-c's twin and arm are published with no certificate.TestQUICDormantPairReturnAfterLedgerReloadWaitsForCertificate, the incident's shape: dormant pair, ledger reload, restate, the source's pod returns without its SVID, then the SVID arrives. Red:Should be empty, but was [quic:echo…@demo/source-a].TestQUICCertificateGateInactiveWithoutAnySecret.TestQUICFirstUsePublishedWhileARegistryReloadIsInFlight, the timing gate. A registry reload is blocked in its listing throughout, and the twin still reaches the snapshot in 1.7 ms (must be < 1 s).server/quic_first_use_test.go, real delta server over bufconn:TestOnDemandSubscribeForATwinTheWildcardAlreadySentIsAnswered: answered in ~117 µs. Red: no response within 2 s.TestOnDemandTwinWaitingForItsCertificateIsHeldNeverAbsent: first use with SPIRE live but no source SVID. The pair is admitted, the subscription is held with noremoved_resources, and the twin arrives on the stream whenSetSecretsbrings the certificate. Red: the twin is served before its certificate.bazel test //agent/internal/xds/... //test/envoy_validate:all(9/9)--config=race //agent/internal/xds/cache:all //agent/internal/xds/server:allbuild --config=lint --@aspect_rules_lint//lint:fail_on_violation //...make format-checkDocs
docs/runbook.md, east-west QUIC section: a paragraph on the fast path, why a twin waits for its certificate, the always-answered subscribe, and the invariant.e2e/soak/README.md, soak: the churn set never starts a pod with a new ServiceAccount, so it is blind to the #1008 class — add a mid-run new-SA pod start and gate init_fetch_timeout on @ clusters #1014 new-ServiceAccount gate: an agent restart immediately before the step is the hard case, with how to run it and what to read.Not changed / open
charts/change.non2xx=0. It is not an NC path.quic:names) have the same go-control-plane silence in principle. They were left alone to keep scope; a plain cluster warms in milliseconds, so it has not shown.Closes #1049
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr