-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fixes #7617 - fixes handling creation of VHDS subscription after Init… #8650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix!
Could you fix below and explain the cleanup block? Thanks!
// Initialize a no-op InitManager in case the one in the factory_context has completed | ||
// initialization. This can happen if an RDS config update for an already established RDS | ||
// subscription contains VHDS configuration. | ||
void RdsRouteConfigSubscription::maybeCreateInitManager( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: return unique_ptrInit::Manager. Maybe optionalInit::ManagerImpl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm populating both init_manager and init_vhds method parameters, I think returning just one of them as the result of the method call would be confusing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fat finger before. Update my opinion. Sorry!
/wait |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes on this one also just to make sure that we have documentation before landing any more VHDS changes. Thank you for making Envoy's documentation first class! :)
@mattklein123: This is just a bugfix, with no changes to existing VHDS functionality, not sure what docs you wanted to go with this PR. |
There are no docs for VHDS currently. I'm using these PRs as a forcing function to get docs into the code base. We should have never gotten this far without docs. |
|
|
ping @lambdai |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! The new integration test case is awesome!
Could you merge master to see if test passes? |
|
You have a use-after-free error because the Rather than just fixing the ordering in the test, I think it's probably better to figure out a way to remove or make explicit the destruction order dependency. |
@zuercher: the issue was that the |
ping @lambdai |
ping @lambdai: I think this is ready to be merged now. |
…Manager has completed initialization Signed-off-by: Dmitri Dolguikh <ddolguik@redhat.com>
ping @lambdai |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in terms of the core fix: The lifetime of CleanUp and Init::Manager is correct.
I don't understand the fuzz failure.
CC @zuercher for more comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple relatively minor things.
@mattklein123 were you documentation concerns addressed?
@@ -111,6 +115,9 @@ class RdsRouteConfigSubscription : Envoy::Config::SubscriptionCallbacks, | |||
return route_config_providers_; | |||
} | |||
RouteConfigUpdatePtr& routeConfigUpdate() { return config_update_info_; } | |||
void maybeCreateInitManager(const std::string& version_info, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not leak this method into the public API of this class. Is it not possible to test its behavior in the context of onConfigUpdate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not leak this method into the public API of this class.
This is a concrete implementation class, not a public interface. I very strongly prefer testability over encapsulation in such a case.
Is it not possible to test its behavior in the context of onConfigUpdate?
I'm trying to test this in isolation; the setup is already difficult (and fragile) enough without dragging in another method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps make it private and make the test class a friend so that it can access it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would result in a dependency to test code in production code, would it not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the friend class statement constitutes a forward reference and needn't ever be declared, but I could be wrong.
@@ -72,6 +72,16 @@ const char Config[] = R"EOF( | |||
cluster_name: xds_cluster | |||
)EOF"; | |||
|
|||
const char RdsWithoutVhdsConfig[] = R"EOF( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer these configs to are created using the protobuf objects directly rather than parsing configs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first time I hear about this preference. This test suit been around for a while now, with this exact setup (and it's not the only test suite to use yaml for setup).
FWIW, configurations used in these tests have enough nested fields/protobufs that building them programmatically will be laborious and harder to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ConfigHelper object underlying the integration test should be helpful here. I'm ok if you leave this as-is for now with a todo to circle back and refactor this test to use ConfigHelper. I think it's a matter of picking one of the default configs from test/utility/config.cc, adding your RDS/VHDS clusters with a ConfigModifier, and adding virtual hosts either with addVirtualHost or createVirtualHost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree re: adding vhds to one of default configs (shared test configuration couples independent tests and can make them brittle), but I see value in adding helper methods to generate VHDS config. Will do, but in a separate PR if that's ok.
@@ -100,6 +110,113 @@ name: my_route | |||
cluster_name: xds_cluster | |||
)EOF"; | |||
|
|||
const char VhostTemplate[] = R"EOF( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There is still no documentation merged for VHDS. Since this is a bug fix I won't hold this PR hostage, but nothing else will be merged until there is docs. |
Signed-off-by: Dmitri Dolguikh <ddolguik@redhat.com>
|
The rest LGTM |
Signed-off-by: Dmitri Dolguikh <ddolguik@redhat.com>
Signed-off-by: Dmitri Dolguikh <ddolguik@redhat.com>
|
Per comment that we'll allow this fix, dimissing Matt's change request.
…Manager has completed initialization
Signed-off-by: Dmitri Dolguikh ddolguik@redhat.com
For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md
Description: Fixes #7617
Risk Level:
Testing: added an integration test
Docs Changes:
Release Notes:
[Optional Fixes #Issue] #7617
[Optional Deprecated:]