Repository navigation
fix(xds): pin the ConfigSource determinism contract Envoy's provider reuse depends on (#852) - #857
Merged
Merged
Conversation
bpalermo
force-pushed
the
fix/852-config-source-hash-determinism
branch
from
September 20, 2026 14:02
fd1533f to
142a59f
Compare
…reuse depends on (#852) aether is safe today, and documentation-only — no behaviour changes. But #852's two premises are both wrong at the pinned Envoy (1.40.0-dev.20260904.13144fb), so the comment records what the source actually says rather than what the issue assumed. Correction 1: initial_fetch_timeout is EXEMPT from the RDS reuse key, not "the first field released into it". addDynamicProvider releases config_source.initial_fetch_timeout before MessageUtil::hash and restores it after (source/common/rds/route_config_provider_manager.h:47-54), so two listeners differing only there still share one provider. #839's field is the one addition that could never have split anything. The exemption is RDS-only: scoped RDS, ECDS and ODCDS hash it in. Correction 2: a map-typed field cannot split a provider. MessageUtil::hash is DeterministicProtoHash::hash on any normal build (utility.cc:166-172) — a reflection walk, not a serialisation — and it folds map entries with ADDITION precisely so order cannot matter (deterministic_hash.cc:78-100). Repeated NON-map fields ARE walked in order and are hash-significant. So the live Envoy-side hazard is a repeated field built by ranging a Go map (ConfigSource.authorities, api_config_source's grpc_services / initial_metadata / config_validators) or a genuine semantic divergence between call sites — not serialisation skew. Maps stay a go-control-plane-side snapshot-version hazard, which is #135's mechanism, currently closed by the Deterministic marshals in TypedConfig and cache MarshalResource. Blast radius, likewise corrected. It is NOT doubled RDS traffic: ads:{} resolves to the one process-wide ADS mux, which rebuilds resource_names through a dedup set on every request (grpc_mux_impl.cc:178-190), so the cost is a single redundant DiscoveryRequest at addWatch and zero steady-state bytes. It is NOT a new stat series where the HCM stat_prefixes match: the allocator dedupes by stat name (allocator.cc:299-316), so one series reads DOUBLE — which is aether's case for out_http and cap_http, whose stat_prefixes are the constants "outbound_http" and "capture_http", while the per-Gateway edge listeners take theirs from the listener name and would split into two trees. The unambiguous signal is /config_dump, where dumpRouteConfigs emits one dynamic_route_configs entry per provider. The real costs are two parsed route tables per worker, a second parse/build per push, and independent warming. No NACK and no warning is right. Adds three guards, all confirmed red before landing: - TestConfigSourceBytesIdenticalAcrossConstructions: twelve independent constructions of every ConfigSource this package hands out must serialise identically. Uses a PLAIN proto.Marshal deliberately — Deterministic:true canonicalises map fields and would go quiet on half of what this is for. - TestConfigSourceCarriesNoMapField: walks the populated message tree and fails on any set map-typed field, which the byte comparison misses for a one-entry map. - TestOutboundChainRDSIdenticalAcrossPods: two pods differing in every field the chain builder reads must produce a byte-identical out_http Rds. Deliberately stricter than Envoy's own key. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
force-pushed
the
fix/852-config-source-hash-determinism
branch
from
September 20, 2026 14:04
142a59f to
79f84ce
Compare
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 #852. Documentation and tests only — no production behaviour changes.
agent/internal/xds/config/common.gois comment-only.Headline: aether is safe, but both of #852's premises are wrong at the pin
Re-verified at
1.40.0-dev.20260904.13144fb(read viagit show 13144fb:<path>, since #844's trace came from a checkout 211 commits ahead).1.
initial_fetch_timeoutis EXEMPT from the RDS reuse key — not "the first field released into it".RouteConfigProviderManager::addDynamicProvider(source/common/rds/route_config_provider_manager.h:47-54) releases it before hashing and puts it back after:So two listeners differing only in
initial_fetch_timeoutdo share a provider. #839's field is the one addition that could never have split anything. The normalisation is unconditional as ofd9bda64c84(envoy#40660, which retired thenormalize_rds_provider_configruntime guard), and it is RDS-only — scoped RDS, ECDS and ODCDS hash it in.Also worth recording: reuse matches on the hash alone.
reuseDynamicProviderdoes a barefind(manager_identifier);route_config_nameappears only inside aRELEASE_ASSERTmessage.2. A map-typed field cannot split a provider.
MessageUtil::hashisDeterministicProtoHash::hashon any normal build (source/common/protobuf/utility.cc:166-172) — a reflection walk, not a serialisation — and it folds map entries with addition, with a comment saying that is exactly the point (source/common/protobuf/deterministic_hash.cc:78-100). Repeated non-map fields are walked in order and are hash-significant.The hazard therefore redraws:
Deterministicmarshals inTypedConfigandMarshalResourceLive Envoy-side risks are
ConfigSource.authoritiesand, ifapi_config_sourceis ever used,grpc_services/initial_metadata/config_validators, plus a genuine semantic difference between call sites (resource_api_versionset on one and not the other,adsvs an equivalentapi_config_source).Corrected blast radius
ads:{}resolves to the single process-wide ADS mux, and the chart'sads_configisapi_type: DELTA_GRPC, so that mux is the delta one. ItsWatchMaprefcounts per resource name:findAdditionsreports a name only whenwatch_interest_had no entry (source/extensions/config_subscription/grpc/watch_map.cc:314-328), and only those names reachupdateSubscriptionInterest(new_grpc_mux_impl.cc:323-335). A second watch on an already-watched name costs zero wire bytes. On the SotW mux it would instead be one redundantDiscoveryRequestataddWatch(grpc_mux_impl.cc:178-190,:298).http.<prefix>.rds.out_http.*appears twice under different scopeshttp.<hcm stat_prefix>.rds.<route_config_name>., and the process-wide allocator dedupes by stat name (source/common/stats/allocator.cc:299-316). Where the prefixes match, one series reads double —config_reload,update_success,update_attemptall +2 per push;version/update_timeareset()and stay honest. That is aether's case forout_httpandcap_http, whose HCM stat_prefixes are the constantsoutbound_http/capture_http. The per-Gateway edge listeners take their stat_prefix from the listener name, so a split there would give two separate trees.Costs #852 did not mention, all real:
/config_dumplists the route config twice (dumpRouteConfigsemits onedynamic_route_configsentry per provider) — the unambiguous detection signal, independent of stat_prefix collision; two fully parsed route tables per worker thread; a second parse/build on every push; independent warming, each provider burning its owninitial_fetch_timeout.Hash-keyed sites aether actually reaches
hash(Rds)minusconfig_source.initial_fetch_timeout(route_config_provider_manager.h:47-54). Consumers: every pod'sout_http, every pod'scap_http, and the per-Gateway edge HTTP + HTTPS + QUIC listeners, which all three nameEdgeGatewayRouteName.StrCat(hash(sds_config_source), ".", config_name, warm)(source/common/secret/secret_manager_impl.h:90-91). Every transport socket.StrCat(hash(config_source), ".", name)—subset.go'sconfig_discovery.hash(odcds_config), timeout included —httpfilter.go.eds_configsits inside theClusterproto that CDS hashes wholesale for its no-op guard.Tests
agent/internal/xds/config/determinism_test.go(new) and one addition tofilterchain_test.go, modelled oncache/determinism_test.go:TestConfigSourceBytesIdenticalAcrossConstructions— 12 independent constructions of each ConfigSource must serialise identically. Uses a plainproto.Marshal:Deterministic:truecanonicalises maps and would go quiet on half of what this is for.TestConfigSourceCarriesNoMapField— walks the populated message tree and fails on any set map field. Catches the one-entry map the byte comparison misses.TestOutboundChainRDSIdenticalAcrossPods— two pods differing in every field the chain builder reads must produce a byte-identicalout_httpRds. Deliberately stricter than Envoy's own key.Confirmed red first
Three temporary production edits, reverted before commit.
Jittered
initial_fetch_timeout:A 6-entry
google_grpc.channel_argsmap inSDSConfigSourceFromCluster— both tests fire, the map test naming the exact path:A pod-derived timeout in the egress Rds:
Validation
bazel test //agent/internal/xds/...green (7/7).bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //agent/internal/xds/...clean.make gazelle/make formatrun. Full//...is green except//agent/internal/proxy/hotrestart:hotrestart_test, which is a pre-existing 2s-tolerance timing assertion incoordination_test.go:150that trips under parallel-build load — unrelated to this change, which touches no non-xds package. Nocharts/change. Not deployed; talos-main untouched.Could not establish
layered_runtimeand noreloadable_featuresoverride anywhere in the chart or bootstrap (the only mention is a comment abouthot_restart_propagate_stat_tags), so Envoy's compiled-in defaults stand:unified_muxandxdstp_based_config_singleton_subscriptionsare both false.DiscoveryRequest— moot. That cost belongs to the SotW mux; aether'sads_configisDELTA_GRPC, so the delta mux'sWatchMaprefcounting applies and the duplicate watch never reaches the wire at all.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr