-
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
http: allow any FilterHeaderStatus::Stop* after sending a local reply. #15496
Conversation
Fixes envoyproxy#14957. Signed-off-by: Piotr Sikora <[email protected]>
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! No idea why this went out of my radar.
Went through some history, this would now match up with continue_iteration
which returns false in all three of these cases so I think this is more consistent, and at least won't cause the bug I was trying to avoid (where it returns true, but local is complete)
envoy/source/common/http/filter_manager.cc
Line 143 in a240824
if (stoppedAll() || status == FilterHeadersStatus::StopIteration) { |
Could we simplify it by making this change:
const auto continue_iteration =
(*entry)->commonHandleAfterHeadersCallback(status, end_stream);
ENVOY_BUG(continue_iteration && state_.local_complete_, "Filter did not return StopAll or StopIteration after sending a local reply");
and then adjust so that we still return early at local complete?
if ((!continue_iteration || state_.local_complete_) && std::next(entry) != decoder_filters_.end()) {
Ah interesting, so this didn't break for us because we always do |
…iteration Signed-off-by: Piotr Sikora <[email protected]>
Signed-off-by: Piotr Sikora <[email protected]>
Done, with correct assert ( |
The use case is the same for all 3 values - to stop request processing. Some extensions (e.g. Wasm, |
What does better behavior mean (besides not triggering |
|
... but none of that should matter after a local reply, in that case they should all be the same? Which takes me back to my original question, after a local reply the most idiomatic thing would be a plain StopIteration given that the behavior is the same across Stop* once a local reply was sent. |
Right, it doesn't really matter which value do you return in this particular case... Although, I'd argue that the plain However, my point was that because of this weird behavior, we completely removed |
Ah, I see -- that makes sense. Linking this to #13737 for potential follow-ups on docs & comments. |
Signed-off-by: Piotr Sikora <[email protected]>
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! LGTM (and thanks for the explanations)
@envoyproxy/senior-maintainers For a quick merge (and FYI) |
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.
Good catch - thanks for fixing this one
Signed-off-by: Piotr Sikora <[email protected]>
/retest |
Retrying Azure Pipelines: |
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.
one last question, otherwise good to go
(*entry)->commonHandleAfterHeadersCallback(status, end_stream) && !state_.local_complete_; | ||
const auto continue_iteration = (*entry)->commonHandleAfterHeadersCallback(status, end_stream); | ||
ENVOY_BUG(!continue_iteration || !state_.local_complete_, | ||
"Filter did not return StopAll or StopIteration after sending a local reply."); | ||
|
||
// If this filter ended the stream, decodeComplete() should be called for it. | ||
if ((*entry)->end_stream_) { |
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.
Do we really want to do any of this work (handle new metadata, add decoded data, etc).
Would it make more sense to early return or does that break something else?
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 honestly don't know the codebase well enough to answer that. Commenting out maybeContinueDecoding()
below breaks a bunch of tests, but I don't know if those are real failures or tests that are not representative of the production code.
In any case, I don't think such risky change should be a part of this bugfix PR.
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.
given it's unlikely folks will be doing sendLocalReply and add decoded data / metadata I buy that as an argument.
Would you instead either throw a TODO my way or, if you want to avoid another round of CI, open a tracking issue to look into 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.
Let's skip the 3h wait on the CI, I filled #15654.
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 LGTM other than Alyssa's remaining comment.
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. Please do fill out release notes (risk, tests etc) next time!
/backport |
Fixes #14957.
Signed-off-by: Piotr Sikora [email protected]