Repository navigation
Description
Summary
When the envoy.filters.http.on_demand filter's odcds (on-demand CDS) config is shared across many routes — as it is when odcds is set at the HTTP connection manager (global http_filters) level rather than per-route filter override — the on-demand cluster subscription resolves the first never-before-seen cluster correctly, but every subsequent distinct cluster requested on that same subscription has its CDS response silently dropped. The downstream request that triggered the lookup then times out at the odcds timeout (default/configured, e.g. 5s) and fails with a 503, even though the control plane sent a correct, well-formed response for the requested cluster.
Confirmed present on 1.37.5 (the current latest release).
Root cause (from source)
NewGrpcMuxImpl::addWatch()registers the on-demand filter's initial subscription with an empty resource-name set, which the internalWatchMaptreats as a wildcard/catch-all watch (wildcard_watches_). This is why the first on-demand cluster lookup on a fresh subscription works — the response is routed to the watch purely by the wildcard fallback, not because the watch's interest was ever updated.- Every later on-demand lookup on that same subscription goes through
NewGrpcMuxImpl::requestOnDemandUpdate(), which only updatessub_state_(i.e., what's sent on the wire in the nextDeltaDiscoveryRequest) viaupdateSubscriptionInterest(). It never touchesWatchMap's per-watchresource_names_/routing state. - When the control plane's response for that second (or Nth) cluster arrives,
WatchMap::watchesInterestedIn()has no record that this watch is interested in that resource name, and the watch is no longer a wildcard/catch-all watch either — so the response resource matches no live watch and is dropped without any error being surfaced. The caller is left waiting until theodcdstimeout fires.
Relevant source: source/extensions/config_subscription/grpc/new_grpc_mux_impl.{h,cc} (requestOnDemandUpdate, updateWatch, addWatch) and source/extensions/config_subscription/grpc/watch_map.{h,cc} (watchesInterestedIn, updateWatchInterest).
What this blocks
Placing odcds globally on the HTTP connection manager's filter chain (OnDemand.odcds), rather than duplicating it into a PerRouteConfig.odcds override on every individual route, is the natural way to get one shared on-demand CDS subscription instead of one-per-route. That's exactly the configuration this bug breaks: a single global on-demand subscription is, by construction, going to be asked to resolve many different never-before-seen cluster names over its lifetime (one per distinct upstream a route first needs), and only the very first one it's ever asked for will actually work. Every cluster after that silently fails with a request-path 503, indistinguishable at the HTTP layer from an unreachable/misconfigured cluster.
Per-route odcds configuration happens to sidestep this because each route gets its own independent subscription that (in the common case) only ever resolves one cluster — but that means per-route placement pays an N-subscription cost (one on-demand gRPC stream per route) on every listener update/hot reload. When there are nearly 10k routes as in our use case, we observed the performance penalty during hot restart sometimes introduced short but elevated level of 503s to some first-requests waiting to resolve cluster spec from odcds. We'd like to use the global placement (one subscription, shared) without that workaround, to mitigate this perf penalty.
Reproduction
Minimal, self-contained Docker Compose setup: Envoy + a small Go control plane.
Two listeners:
odcdsconfigured per-route on two routes (/a→ on-demand clusteron-demand-a,/b→on-demand-b). Both requests succeed (200), since each route has its own subscription.odcdsconfigured globally on the HTTP connection manager, routes/a→on-demand-x,/b→on-demand-y, no per-route override (one shared subscription). Requesting/afirst succeeds (200) — the first cluster, resolved via the wildcard-watch fallback. Requesting/bnext times out and returns503after theodcdstimeout, even though the control plane log shows it sent a correctDeltaDiscoveryResponsecontainingon-demand-y.
Confirming stats after the failing request:
http.global_on_demand.no_cluster: 1
http.global_on_demand.downstream_rq_5xx: 1
http.global_on_demand.downstream_rq_time: ~5000ms (matches the 5s odcds timeout)
i.e. the response was sent but never resulted in the cluster being added — consistent with the response being dropped at the WatchMap routing step rather than any network/control-plane issue.
Happy to share the full repro (bootstrap config + control plane source + driver script) — kept it out of this report to avoid an unreviewed external link.
Environment
- Envoy:
1.37.5(envoyproxy/envoy:v1.37-latestDocker image) - Control plane: hand-rolled minimal delta-CDS server (Go,
go-control-planev0.14.0 protos for message types) - Reproduced with Docker Compose on macOS (arm64)
Notes
We believe this is the same underlying issue fixed by #46216 ("config: fix a bug where the on demand subscription not works"), which reworks requestOnDemandUpdate/addWatch to also update WatchMap (via a new appendWatchInterest/accept() path) instead of only the wire-level subscription state. Filing this issue to have a citable tracking issue for that fix and to document the specific global-vs-per-route on_demand blast radius, to add more concrete color on the scope of the issue the original PR was trying to solve.
Activity
github-actions commentedon Sep 5, 2026
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
github-actions commentedon Sep 12, 2026
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.
config: fix a bug where the on demand subscription not works (envoypr…