Skip to content

on_demand: continue to the router when the VHDS vhost has no matching route - #48079

Merged
wbpcode merged 1 commit into
envoyproxy:mainfrom
wdauchy:fix/on-demand-vhds-no-matching-route
Oct 8, 2026
Merged

wbpcode merged 1 commit into
envoyproxy:mainfrom
wdauchy:fix/on-demand-vhds-no-matching-route

Conversation

@wdauchy

@wdauchy wdauchy commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Commit Message: on_demand: continue to the router when the on-demand VHDS virtual host has no matching route.

Additional Description:
After #47183, onRouteConfigUpdateCompletion() re-runs decodeHeaders() once VHDS reports that the
virtual host exists. route_exists only means the virtual host exists, not that one of its routes
matches the request. If none match, decodeHeaders() requests the same virtual host again. Since
#46216 that repeated request is not sent, so the request waits until the stream idle timeout.
Before #46216 it was sent and answered again, so the request looped on VHDS. The legacy
recreateStream() path has the same problem.

This change re-checks route() after refreshing the route config snapshot. route_exists now means
a route was found, as the scoped RDS callback already reports. If no route matches, the filter
continues to the router, which replies with a 404.

Tradeoff: a virtual host that only gains the matching route in a later VHDS update is no longer
picked up while the request waits. Upstream never answered this case before: the request looped
or waited until the stream idle timeout.

Related PRs:

Risk Level: Low. Guarded, limited to on-demand VHDS.
Testing: New unit tests in on_demand_filter_test cover both values of the new guard and of
on_demand_vhds_no_recreate_stream. New integration tests in vhds_integration_test cover both
on_demand_vhds_no_recreate_stream values. Without the fix, the new tests with the guard enabled
fail and the integration requests time out waiting for a response. on_demand_filter_test,
vhds_integration_test, odcds_integration_test and on_demand_integration_test pass.
Docs Changes: N/A
Release Notes: Added under changelogs/current/bug_fixes.
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.on_demand_vhds_require_route_match (default true). Set
it to false to restore the previous behavior.

AI assistance: Cursor helped trace the issue and write the tests. I reviewed and understand all
changes.

… route

Commit Message: continue to the router when the on-demand VHDS virtual host has no matching route.

Additional Description:
After envoyproxy#47183, onRouteConfigUpdateCompletion() re-runs decodeHeaders() once
VHDS reports that the virtual host exists. If none of the routes of the
delivered virtual host match the request, decodeHeaders() requests the same
virtual host again. Since envoyproxy#46216 that repeated request is not sent, so the
request waits until the stream idle timeout. Before envoyproxy#46216 it was sent and
answered again, so the request looped on VHDS. The legacy recreateStream()
path has the same problem.

After refreshing the route config snapshot, the filter now treats the update
as resolved only if a route matches, so route_exists means a route was
found, as scoped RDS already reports. Otherwise it continues to the router,
which replies with a 404.

A virtual host that only gains the matching route in a later VHDS update is
no longer picked up while the request waits. This case never got an answer
before: it looped or hung.

Risk Level: low, guarded behavior change limited to on-demand VHDS.
Testing: new unit tests in on_demand_filter_test cover both guard values.
New integration tests in vhds_integration_test cover both
on_demand_vhds_no_recreate_stream values. Without the fix, the new tests
with the guard enabled fail and the integration requests time out waiting
for a response. on_demand_filter_test, vhds_integration_test,
odcds_integration_test and on_demand_integration_test pass.
Docs Changes: n/a
Release Notes: added (changelogs/current/bug_fixes)
Platform Specific Features: n/a
Runtime guard: envoy.reloadable_features.on_demand_vhds_require_route_match
(default true). Set it to false to restore the previous behavior.

Signed-off-by: William Dauchy <[email protected]>
@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #48079 was opened by wdauchy.

see: more, trace.

@wdauchy

wdauchy commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@wdauchy
wdauchy marked this pull request as ready for review October 6, 2026 19:11
@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #48079 was ready_for_review by wdauchy.

see: more, trace.

@wdauchy

wdauchy commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@wbpcode wbpcode left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@wbpcode
wbpcode merged commit d158647 into envoyproxy:main Oct 8, 2026
26 of 27 checks passed
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.

4 participants