-
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
ext_proc filter crash when sending trailers when request has no body #27430
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,7 +195,9 @@ class Filter : public Logger::Loggable<Logger::Id::ext_proc>, | |
|
||
void sendBufferedData(ProcessorState& state, ProcessorState::CallbackState new_state, | ||
bool end_stream) { | ||
sendBodyChunk(state, *state.bufferedData(), new_state, end_stream); | ||
if (state.hasBufferedData()) { | ||
sendBodyChunk(state, *state.bufferedData(), new_state, end_stream); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another observation: the call in case of an empty body, will not change the state to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's a good catch. We should send an empty body if no buffered data as in the new diffs. |
||
} | ||
} | ||
void sendBodyChunk(ProcessorState& state, const Buffer::Instance& data, | ||
ProcessorState::CallbackState new_state, bool end_stream); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 not an expert on ext-proc, so high-level observation.
IIUC the current fix prevents sending a body of length 0 with end_stream. If this is the desired behavior, then I think it is ok.
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!
Actually, ext_proc filter supports sending a body of length 0:
envoy/test/extensions/filters/http/ext_proc/ext_proc_integration_test.cc
Line 1464 in 84641e1
This change is causing test failures. So, we changed it into if the no buffered data, then sends an empty body.
After that, we seeing another issue with stream_ pointer as null, so the new change also fixed it. Please check the root cause comments for details.