Skip to content

fix(agent): always publish out_http so the egress listener's RDS resolves (#817) - #839

Merged
bpalermo merged 2 commits into
mainfrom
fix/817-egress-rds-initial-fetch
Sep 20, 2026
Merged

bpalermo merged 2 commits into
mainfrom
fix/817-egress-rds-initial-fetch

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Fixes #817.

The defect, and a correction to the filed mechanism

The node's egress listener routes over RDS for out_http
(agent/internal/xds/proxy/filterchain.go), and snapshot.go emitted that route
config only when len(vhosts) > 0 — unlike the edge and capture route
configs, which are always emitted so their RDS resolves. An agent that starts
with nothing to publish (the local-only fallback loadInitialRegistryConfig
takes when the registry cannot serve endpoints inside its 15 s budget) therefore
published no route config at all.

The issue says "no initial_fetch_timeout anywhere, so Envoy does not wait".
Envoy waited, and it waited exactly 15 s — that field's default is 15 s, and
the measured w02 timeline is a ~15 s wait, not a zero-length one:

event timestamp Δ from LDS
new-epoch LDS update_time 16:08:50.558Z —
first 404 NR 16:09:05.214Z +14.656 s
last 404 NR 16:09:08.032Z +17.474 s
first out_http RDS update 16:09:08.123Z +17.565 s

14.656 s is the initial_fetch_timeout expiring, not a listener that never
waited. That matters for the fix, because it means setting
initial_fetch_timeout cannot close this window
— see below.

The reason the subscription was silent for the whole 15 s, rather than being
answered with an empty table, is that the mesh runs delta ADS
(api_type: DELTA_GRPC in the proxy bootstrap). In go-control-plane v0.14.0:

  • createDeltaResponse puts a subscribed name into removedResources only when
    it was previously returned (prevVersion, found := sub.ReturnedResources()[name]
    … else if found). A brand-new epoch's first out_http subscription has
    found == false, so a snapshot without out_http produces neither a resource
    nor a removal.
  • respondDelta then writes nothing: if len(resp.resources) > 0 || len(resp.removedResources) > 0 || (sub.IsWildcard() && request.ResponseNonce == "").
    RDS is not wildcard.

So the watch sits open and silent, Envoy's out_http init target never fires,
the listener warms out and activates with no route table. Confirmed in the
red test output below, where the whole RouteType map is nil, not empty.

What this changes

  1. out_http is emitted unconditionally (agent/internal/xds/cache/snapshot.go),
    exactly as the edge and capture route configs already are. This is the change
    that actually closes the window: the subscription resolves on the first push.
    BuildOutboundRouteConfiguration's on-demand catch-all makes the zero-vhost
    table a working one rather than a silent 404 machine — liveness 200 on
    MeshLivePath (the proposal 013 prober target lives only there),
    mesh-shaped authorities to their cluster via ODCDS, hard 404 for anything
    foreign. fix(capture): on-demand catch-all + default mesh-DNS/capture on #288's capture catch-all is untouched; BuildCaptureRouteConfiguration
    keeps building it exactly as before.
  2. The egress RDS config source states initial_fetch_timeout explicitly.
  3. Both route-config builders now own their virtual_hosts slice instead of
    append-ing the catch-all onto the caller's backing array. Latent today
    (no current caller reuses the slice), but it is a one-line hazard in a
    function whose whole job is to hand Envoy a table.

The initial_fetch_timeout value: 15 s, and why

initial_fetch_timeout is a fail-open bound, not a gate. When it expires
Envoy activates the listener anyway, with whatever it has — which for a route
config that never arrived is nothing. No value of this field can prevent a
listener going active with an unresolved route table; it only decides how long
the control plane gets first. That is why item 1 above is the fix and this is
the pin.

  • 15 s is Envoy's own default, so stating it changes no behaviour. What it
    buys is that the value becomes protocol-visible and assertable — today the
    mesh's warming budget is an upstream default nothing in this repo mentions,
    and an upstream default can drift under us.
  • 15 s is also the agent's registryReadyTimeout (server.go), the budget
    PreListen spends before falling back to local-only. Anything shorter would
    let a fresh Envoy epoch activate the egress listener while the agent that
    feeds it is still inside its own initial-snapshot budget — reopening precisely
    this 404 window. The two constants are now cross-referenced in comments and a
    test asserts the 15 s value so they cannot drift apart silently.
  • Longer is not free. On a hot restart a longer warm is harmless (the parent
    epoch still serves), but on a cold proxy start there is no parent: extra
    warming is extra time with no egress listener at all, and listeners_warming
    holds the pod un-Ready for it.
  • 0 (wait forever) is rejected deliberately. An agent that is permanently
    unable to publish would wedge the egress listener in warming for the life of
    the process and the proxy would never report Ready — turning a degraded route
    table into a total node data-plane outage. Fail-static on a stale table beats
    fail-closed on no listener.

It is applied to the egress RDS only. The capture and edge route configs were
already emitted unconditionally, so their subscriptions resolve on the first
push and the timeout is not load-bearing for them; leaving them alone keeps the
diff to the resource this issue is about.

The negative-interval regime (LDS pushed after RDS)

The soak's TRIPLE showed w03 −2,393 ms and w04 −77,046 ms. Asked whether
that is harmless in general or only when an epoch survives to hold the cache:

It is harmless in general, and not for the reason the run's framing suggests.
Envoy's RouteConfigProviderManagerImpl keys route-config providers by
(route_config_name, config_source hash) and shares them across listeners. A
listener update that rebuilds the HCM re-uses the existing out_http provider,
whose local_init_target_ is already ready and whose last-delivered table is
already in hand — so the new listener does not warm on RDS at all and goes active
with routes immediately. The cache is provider-scoped, not epoch-scoped; a
listener re-push cannot invalidate it, which is what makes the ordering
irrelevant within a process.

The corollary is the important part: the negative regime and the failure regime
are structurally disjoint.
Across an epoch boundary the provider manager starts
empty, so the interval is necessarily positive (subscription begins after the
listener is created) — that is the healthy 33–321 ms band. A negative interval
can therefore only ever be observed inside a surviving process, which is
exactly the case where the cached table is guaranteed to be there.

w04's 77 s is not a risk signal, it is a measurement of how long the agent was
absent
(agent + proxy rolled concurrently: xDS socket gone, ADS stream broken,
update_time only advances on reconnect-and-push). During those 77 s Envoy
served fail-static from its cached config, which is correct xDS behaviour. Also
consistent with the observed agent-roll signature — update_attempt rising while
update_success and config_reload stay at 1 — which is just "the route config
content did not change, so Envoy did not reload it".

Recommendation: no separate fix. But grading a negative RDS−LDS interval
against the positive healthy band is a category error, and the dashboard/runbook
framing should say so — it is a control-plane-absence measurement, not a
data-plane-risk one.

One residual I could not establish offline, and would not bundle here: the
provider is held by shared_ptr from the listeners referencing it, so on a node
that drains to zero meshed pods the egress listener (and with it the last
reference) goes away, and the next pod ADD re-subscribes cold — back in the
warming regime. There is no traffic in that window by construction, so it looks
benign, but I have not confirmed the teardown actually happens in the pinned
build. Worth its own issue if anyone wants it nailed down.

Verification

bazel test //agent/internal/xds/... and //test/envoy_validate:all pass;
bazel test //... is green apart from //agent/internal/proxy/hotrestart:hotrestart_test,
a pre-existing parallel-load flake (errno=98 binding the hot-restart domain
socket) that passes in isolation and is untouched by this change. Lint
(--config=lint --@aspect_rules_lint//lint:fail_on_violation) and
make format-check are clean.

The red test, before the production fix

With snapshot.go and filterchain.go reverted to main and the new tests in
place:

--- FAIL: TestGenerateSnapshot_ZeroVhostsStillPublishesOutboundRoute (0.00s)
    outboundroute_test.go:56:
        	Error:      	map[string]types.Resource(nil) does not contain "out_http"
        	Messages:   	out_http must be published even with zero vhosts, or the egress listener's RDS never resolves (#817)
--- FAIL: TestGenerateSnapshot_OutboundRouteSurvivesEmptyingTheRegistry (0.01s)
    outboundroute_test.go:117:
        	Error:      	map[string]types.Resource(nil) does not contain "out_http"
--- FAIL: TestOutboundChainRDSInitialFetchTimeout (0.01s)
    filterchain_test.go:133:
        	Error:      	Expected value not to be nil.
        	Messages:   	the egress RDS warming budget must be explicit, not inherited
--- FAIL: TestNodeBootstrapEgressRDSInitialFetchTimeout (0.03s)
    validate_test.go:216: listener "outbound_http_test-pod": out_http RDS config source has no initial_fetch_timeout

map[string]types.Resource(nil) rather than an empty map is the defect verbatim:
the RouteType set is absent, not empty, which is what makes delta ADS answer with
silence.

test/envoy_validate

It can assert both, and now does:

  • initial_fetch_timeout: TestNodeBootstrapEgressRDSInitialFetchTimeout
    re-parses the serialised node bootstrap — the same bytes envoy --mode validate
    loads — walks to the HCM carrying rds.route_config_name == out_http and
    asserts the value. Parsing the serialised form rather than the in-memory
    builder output is deliberate: a field lost in marshalling, or stripped
    alongside the custom filters, would pass an in-memory check.
  • the always-present route config: the harness cannot observe control-plane
    snapshot behaviour (that is the cache unit test's job), but it can prove the
    zero-vhost table a real Envoy now has to load is accepted. New
    outbound_zero_vhost_route_bootstrap.json scenario inlines
    BuildOutboundRouteConfiguration(nil, meshDomain) as a static route_config
    and runs it through the pinned Envoy binary. Passing, alongside the six
    existing scenarios:
    --- PASS: TestEnvoyValidate/outbound_zero_vhost_route_bootstrap.json (0.06s)

No chart changes, so no Chart.yaml bump.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-Authored-By: Claude Opus 5 [email protected]
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…lves (#817)

The node's egress listener routes over RDS for `out_http`, but the snapshot
builder emitted that route config only when `len(vhosts) > 0`. An agent that
starts with nothing to publish — the local-only fallback
`loadInitialRegistryConfig` takes when the registry cannot serve endpoints
within its 15s budget — therefore published no route config at all.

Under delta ADS that is not "an empty route table", it is NO RESPONSE AT ALL.
go-control-plane's `respondDelta` writes a response only when the subscription
yields resources or removals, and a first-time RDS subscriber to a name the
snapshot has never carried yields neither (`found` is false in
`createDeltaResponse`, so it is not even a removal). The watch stays open and
silent, Envoy's `out_http` init target never fires, the egress listener warms
for the full `initial_fetch_timeout` and then activates with an unresolved
route table — 404 NR route_not_found on everything until a later snapshot
finally carries `out_http`.

Measured on main-worker-02, 2026-09-19: LDS at 16:08:50.558Z, first 404 at
16:09:05.214Z (14.7s, i.e. Envoy's 15s default timeout), last 404 at
16:09:08.032Z, first `out_http` RDS update 91ms later. The listener served
traffic for ~17.5s before its route table existed.

Changes:

- `out_http` is now emitted unconditionally, exactly as the edge and capture
  route configs already are, so the subscription resolves on the first push.
  Its on-demand catch-all makes the zero-vhost table a working one: the
  liveness 200, mesh-shaped authorities to their cluster via ODCDS, and a hard
  404 for anything foreign.
- The egress RDS config source now states `initial_fetch_timeout` explicitly at
  15s. That is Envoy's own default, so this is a pin rather than a behaviour
  change; it is also the agent's `registryReadyTimeout`, and a shorter budget
  would let a fresh epoch activate while the agent feeding it is still inside
  its own initial-snapshot budget. 0 (wait forever) is rejected deliberately:
  it would wedge the listener in warming for the life of the process.
- Both route-config builders now own their `virtual_hosts` slice instead of
  appending the catch-all onto the caller's backing array.

Tests: a zero-vhost snapshot must publish a resolvable `out_http` carrying the
catch-all (fails on main with `map[string]types.Resource(nil) does not contain
"out_http"`); the same for a node whose dependency set empties; the RDS
`initial_fetch_timeout` is asserted both on the built filter chain and on the
serialised node bootstrap; and `//test/envoy_validate` gained a scenario that
runs the zero-vhost `out_http` table through a real Envoy config loader.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit f04901f into main Sep 20, 2026
20 checks passed
@bpalermo
bpalermo deleted the fix/817-egress-rds-initial-fetch branch September 20, 2026 11:20
bpalermo added a commit that referenced this pull request Sep 20, 2026
…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 added a commit that referenced this pull request Sep 20, 2026
…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 added a commit that referenced this pull request Sep 20, 2026
…reuse depends on (#852) (#857)

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.


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant