-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rds: make RouteConfigProvider shared among ListenerImpls, or move factory_context_ outside of Listener. #8303
Comments
Thank you for writing the summary! WRT InitManager:
WRT PerFilterConfigs Below is a list each RDS related FactoryContext usage. It may contain half truth.
|
Thanks for the list, I think except for the per_filter_configs_ in
routeEntry, everything else is simply delegated to Server::Instance from a
ListenerImpl.
…On Fri, Sep 20, 2019 at 1:24 PM Yuchen Dai ***@***.***> wrote:
Thank you for writing the summary!
WRT InitManager:
It's arguable if the current usage of InitManager is in a good shape. I am
seeing
1. undefined behavior: Adding target to initialized InitManager (@
vhds)
2. not adding target to another init manager (@ reusing subscription)
I think we need SharedTarget(see my prototype here
<lambdai/envoy@1da5cbe>),
also it's probably not ok to use listener's init manager everywhere.
WRT PerFilterConfigs
It's not allowed to use listener specific config if RDS is shared among
listeners. As currently the code base is not utilizing listener specific
config we should remove it ASAP to avoid people not aware of the design
change.
Below is a list each RDS related FactoryContext usage. It may contain half
truth.
vhds subscription
scope() clusterManager() initManager() at ctor
staticrouteconfigproviderimpl
timesource()
RdsRouteConfigSubscription
scope() messageValidationVisitor() clusterManager() timeSource()
RdsRouteConfigProviderImpl
threadLocal()
ConfigImpl
scope()
RouteEntryImplBase
runtime() messageValidationVisitor() api() Dispatcher().Timesource()
WeightedClusterEntry
PerFilterConfig
runtime()
VirtualHostImpl
scope() runtime() cm()
RouteMatcher
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8303?email_source=notifications&email_token=AA2I6TD6GTNTNCPKGQNAFSLQKUBMXA5CNFSM4IYR5PAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7HLQVQ#issuecomment-533641302>,
or mute the thread
</~https://github.com/notifications/unsubscribe-auth/AA2I6TBFBJ3R5UUS3SXZ4J3QKUBMXANCNFSM4IYR5PAA>
.
--
Xin Zhuang
|
@stevenzzzz @lambdai I like the idea of splitting the context into effectively a server/global context and a listener context. Can we do that first? |
My current wip on rds dedup is using the impl of Once I get the PR close to workable, I can propose the granular of |
@alyssawilk @htuch FYI |
Introduce ServerFactoryContext which is an implementation of CommonFactoryContext. Comparing to ListenerFactoryContext, ServerFactoryContext has a wider lifetime. This is the prerequisite to share rds configuration among listeners. Also experimenting move messageValidateVisitor out of CommonFactoryContext. The benefit is that now Server::Instance perfectly implements CommonFactoryContext. ServerFactoryContext doesn't implement the function. The test shows it is never invoked. Will put messageValidateVisitor into FactoryContext: this piece of work will be done in follow up PR This PR is extracted from #8454 Fixes #8303 Signed-off-by: Yuchen Dai <silentdai@gmail.com>
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 other activity occurs. Thank you for your contributions. |
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". Thank you for your contributions. |
Title: To resolve issues like #7923, or migrate RDS to config-provider-framework, we need to make sure RdsRouteConfigProvider "Listener independent".
Description:
If we want to save memory on dedup the copy of RDS route config providers (e.g., #7923 ), we would need to make sure the referenced FactoryContext outlives a ListenerImpl.
Besides that, a RDS Subscription is held globally (weak_ptr) by the SingletonManager[RdsConfigProviderManager],which could be shared between Listeners, but the RDSSubscription also holds a reference to the factoryContext (in this case, ListenerImpl). If LDS updates a listener A, a live RDSSubscription owned by another listener B may crash Envoy when it tries to read from the destructed FactoryContext(ListenerImpl). VHDS implementation has a TODO that stated this concern:
/~https://github.com/envoyproxy/envoy/blob/master/source/common/router/rds_impl.cc#L113
Proposal:
One way to make the factoryContext referenced by router/... is to pass a Server::CommonFactoryContext (e.g. the Server::Instance ) instead of a Server::FactoryContext (only implemented by ListenerImpl) into the router/...
Right now, most of the APIs desired by objects under router/... are actually from CommonFactoryContext, except for several places that are kinda Listener specific:
We could possibly pass the current ListernerImpl::initManager() along with the CommonFactoryContext(a.k.a the Server::Instance) to router/... As it's only required at Subscription Start time.
This is the place where users could insert their own per-filter-per-route config data, a FactoryContext is passed in to translate the opaque protobuf::Struct into C++ RouteSpecificFilterConfig object. In the upstream codebase, this parameter is not used in any translation so far. But there is a risk some users' translation may fail if they depends on some per-listener data during the translation, if we decide to move forward by passing a CommonFactoryContext into router/... instead of the ListenerImpl itself.
The text was updated successfully, but these errors were encountered: