Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Refactor cluster manager init sequence. #33221
Refactor cluster manager init sequence. #33221
Changes from 2 commits
69325cf
0555ec2
35c94ad
50abdf3
666a0fe
106e9f6
1fb625e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Not sure if this completely resolve our problem. This ensure the server context could always return a valid reference to the cluster manager. But what will happen when the upstream network filter or upstream http filter try to access the actual content of the cluster manager when doing the initialization?
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.
Thanks for the comments!
When router filter is trying to call processFilters() for upstream filters:
envoy/source/common/router/router.cc
Line 108 in 63bc9b5
it does access context.serverFactoryContext().clusterManager(). IIUC, this is in the much later stage, so the cluster manager instance is already initialized.
In the ClusterInfoImpl c'tor, which is called during cluster_manager_->init()
envoy/source/common/upstream/upstream_impl.cc
Line 1376 in 63bc9b5
envoy/source/common/upstream/cluster_manager_impl.cc
Line 905 in 63bc9b5
It's accessing the cluster_manager_, i.e, *this, before it is initialized. This means ClusterInfoImpl c'tor only needs an instance of cluster manager, and does not require it is initialized.
Unfortunately, for composite filter in upstream chain case, it needs to access the cluster_manager_ from from outside here:
envoy/source/extensions/filters/http/composite/action.cc
Line 43 in 63bc9b5
That's the reason we need to make sure the server_factory_context.clusterManager() is setup before it is initialized.
BTW, for composite filter in upstream case, it also only needs an instance of cluster manager, and does not require it is initialized.