xds: remove warming listeners in xDS SOTW updates#12461
xds: remove warming listeners in xDS SOTW updates#12461asraa merged 8 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Sam Flattery <samflattery@google.com>
|
/cc @asraa |
|
/retest |
|
🔨 rebuilding |
|
Pipelines seems to be down https://status.dev.azure.com/ |
| * existing listeners. The references are only valid in the context of the current call stack and | ||
| * should not be stored. | ||
| */ | ||
| virtual std::vector<std::reference_wrapper<Network::ListenerConfig>> allListeners() PURE; |
There was a problem hiding this comment.
When changing the API of a class, think about how the methods look in code that uses the class. Do the names of functions make it clear what is happening?
In this case, the class has two public methods:
listeners() : Returns some of the listeners.
allListeners(): Returns all of the listeners.
If I saw a call to listeners() in some code, I would not expect that it returns some listeners, or know which ones.
Ideas to fix this:
-
Rename
listeners()toloadedListners(),activeListners(), etc. -
Make the type of listeners to return an enum:
enum ListenerState {
ACTIVE = 1,
WARMING = 2,
ALL = 3
}
Function listeners(ListenerState state) would return the listeners in the given state.
There was a problem hiding this comment.
Thanks for the feedback. I was thinking of changing listeners() to activeListeners() but I didn't want to be too disruptive to the code base since listeners() is used in a lot of different places (mostly in tests). But if you're happy enough with this I can go ahead and do it.
There was a problem hiding this comment.
@asraa knows this code better than I do, and I would defer to her judgement.
There was a problem hiding this comment.
(2) Along with draining listeners might be good. It can default to active listeners as currently used. @lambdai What do you think?
There was a problem hiding this comment.
I am fine to add draining listener in the query.
Though to fix the fuzzer issue we don't need the names in drain list.
There was a problem hiding this comment.
Sure, I'll do this and add draining listeners too
|
cc @lambdai PTAL |
There was a problem hiding this comment.
Nice diagnose!!
Could you add a new test case in ListenerManagerImplTest beside
TEST_F(ListenerManagerImplTest, RemoveListener)?
You may want to
- start the workers
- provide a lds response with an unique name
- don't call ready() of the new listener
- provide a lds response w/o that unique name
And see if the listeners are erased from the new allListeners().
| * existing listeners. The references are only valid in the context of the current call stack and | ||
| * should not be stored. | ||
| */ | ||
| virtual std::vector<std::reference_wrapper<Network::ListenerConfig>> allListeners() PURE; |
There was a problem hiding this comment.
I am fine to add draining listener in the query.
Though to fix the fuzzer issue we don't need the names in drain list.
Signed-off-by: Sam Flattery <samflattery@google.com>
I looked into this and I'm not sure if this is possible in envoy/test/server/listener_manager_impl_test.cc Lines 151 to 154 in c2b0d37 I could do it in envoy/test/server/lds_api_test.cc Lines 271 to 278 in c2b0d37 listeners() which is what that test does.
|
Signed-off-by: Sam Flattery <samflattery@google.com>
|
Failing edit: also failing |
Signed-off-by: Sam Flattery <samflattery@google.com>
Signed-off-by: Sam Flattery <samflattery@google.com>
Is it possible to reproduce this in |
|
@asraa that's definitely possible. I'll do that now |
Signed-off-by: Sam Flattery <samflattery@google.com>
|
@asraa added |
|
@lambdai If the test looks good to you, this has my LGTM. |
lambdai
left a comment
There was a problem hiding this comment.
The comment should start with capital letter and end with period.
The code LGTM. Thanks!
Signed-off-by: Sam Flattery <samflattery@google.com>
Signed-off-by: Sam Flattery samflattery@google.com
Commit Message: Remove warming listeners in xDS SOTW updates
Additional Description:
LdsApiImpl::onConfigUpdateto use a new function inListenerManagerImpl,allListeners()instead of the oldlisteners()which just returns active listeners to compute the diff between the update and the current SOTWlds_api_test.ccto use this new functionRisk Level: Medium
Testing: passes regression corpus entry, passes lds_api_test.cc
Docs Changes: N/A
Release Notes: N/A
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24600