Repository navigation
Conversation
Backport to release/v1.35 of #43175. This is a cherry-pick of the release/v1.36 commit ac77ca1, which in turn cherry-picked the release/v1.37 commit 567847a5ed947b0ae3a6f10ecefb0b9ac8c17605, itself a cherry-pick of the main-branch commit 867251ab48bb4fda89ead154bbc600131cf614ad. This is the 2nd attempt to fix envoyproxy/envoy#41654. The 1st attempt is envoyproxy/envoy#43042 The root cause of the issue is when the 2nd filter resume the processing, `doData(observedEndStream() && !had_trailers_before_data)` in `source/common/http/filter_manager.cc` uses an outdated `observedEndStream()` flag as `end_of_stream`. This flag is set to true once Envoy sees data with end_of_stream set to true either from downstream client or backend server. However, in the ext_proc case, after the data with end_of_stream=true is received by Envoy, it is sent out to the side-stream server and re-injected back to Envoy, the `observedEndStream()` flag has to be updated during re-injection. Otherwise, the 2nd filter `commonContinue()` deems the full body is in buffer, i.e. end_of_stream=true, even the 1st filter is still injecting more data. The issue is reproduced in both ext_proc STREAMED and FULL_DUPLEX_STREAMED modes, also in both request and response directions. Please check the added integration tests. Backport notes (changes needed to resolve conflicts against 1.35): - The source fix (filter_manager.cc, processor_state.cc) and the `envoy.reloadable_features.ext_proc_inject_data_with_state_update` runtime guard applied cleanly; the unrelated `generic_proxy_codec_buffer_limit` guard in the surrounding context does not exist on 1.35 and was dropped. - 1.35 predates the 1.36 ext_proc test refactor, so it has no `ext_proc_integration_common.*`, `filter_test_common.*` or `ext_proc_full_duplex_integration_test.cc`. The new files the cherry-pick tried to add were dropped, and all test changes were ported into 1.35's monolithic `ext_proc_integration_test.cc` and `filter_test.cc` instead: the runtime-guard override in the config setup, the `two_ext_proc_filters_` config path and its helpers (`addDownstreamExtProcFilter`, `server1*` gRPC helpers), the extracted `initializeConfigDuplexStreamed`, and the three new `TwoExtProcFilters*` full-duplex tests plus the two STREAMED tests. - 1.35 lacks the `ContainsHeader` matcher, so the ported tests use the equivalent `SingleHeaderValueIs` matcher already imported in the file. - The 1.37-only `DuplexStreamedServerResponseWithSynthesizedTrailer` test is disabled (renamed `DISABLED_*`); it depends on behavior not present on 1.35. - Fuzzer: kept only the `ext_proc_inject_data_with_state_update` runtime override. Signed-off-by: Yanjun Xiang <[email protected]> Signed-off-by: Boteng Yao <[email protected]> Signed-off-by: Jonh Wendell <[email protected]> Co-Authored-By: Claude Opus 4.8 <[email protected]>
dcillera
self-requested a review
September 15, 2026 17:35
|
This is a clean, faithful backport of upstream Envoy fix #43175 (originally main commit 867251ab) to release/v1.35. The tests: have been successfully executed locally. |
dcillera
approved these changes
Sep 15, 2026
jwendell
added a commit
that referenced
this pull request
Sep 23, 2026
…#620) Backport to release/v1.34 of #43175. This is a cherry-pick of the release/v1.35 commit 05ae42b, which in turn backported the release/v1.36 commit ac77ca1, itself a cherry-pick of the release/v1.37 commit 567847a5ed947b0ae3a6f10ecefb0b9ac8c17605, itself a cherry-pick of the main-branch commit 867251ab48bb4fda89ead154bbc600131cf614ad. This is the 2nd attempt to fix envoyproxy/envoy#41654. The 1st attempt is envoyproxy/envoy#43042 The root cause of the issue is when the 2nd filter resume the processing, `doData(observedEndStream() && !had_trailers_before_data)` in `source/common/http/filter_manager.cc` uses an outdated `observedEndStream()` flag as `end_of_stream`. This flag is set to true once Envoy sees data with end_of_stream set to true either from downstream client or backend server. However, in the ext_proc case, after the data with end_of_stream=true is received by Envoy, it is sent out to the side-stream server and re-injected back to Envoy, the `observedEndStream()` flag has to be updated during re-injection. Otherwise, the 2nd filter `commonContinue()` deems the full body is in buffer, i.e. end_of_stream=true, even the 1st filter is still injecting more data. The issue is reproduced in both ext_proc STREAMED and FULL_DUPLEX_STREAMED modes, also in both request and response directions. Please check the added integration tests. Backport notes (changes needed to resolve conflicts against 1.34): - The source fix (filter_manager.cc, processor_state.cc) applied cleanly. - runtime_features.cc: kept 1.34's existing ext_proc guards and inserted only the new `envoy.reloadable_features.ext_proc_inject_data_with_state_update` guard alphabetically; the 1.35-only `ext_proc_fail_close_spurious_resp` context guard does not exist on 1.34 and was dropped. - All test changes were ported into 1.34's monolithic `ext_proc_integration_test.cc`: the `two_ext_proc_filters_` config path and its helpers (`addDownstreamExtProcFilter`, `server1*` gRPC helpers), the extracted `initializeConfigDuplexStreamed`, the renamed header/body helpers, and the five new `TwoExtProcFilters*` tests. - The `ServerSendOutOfOrderResponseDuplexStreamed` test kept 1.34's own 400-response behavior; only the mechanical helper renames were applied (the 1.35 500-response variant was not adopted). - The 1.35-only tests that appeared in the conflict but are unrelated to this feature (`DISABLED_DuplexStreamedServerResponseWithSynthesizedTrailer`, `BufferedModeOverSizeRequestLocalReply`, `FilterStateAccessLogSerialization`, and the other Pack*/*Trailers* tests) belong to other commits not backported to 1.34 and were dropped. Signed-off-by: Jonh Wendell <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport to release/v1.35 of #43175. This is a cherry-pick of the release/v1.36 commit ac77ca1, which in turn cherry-picked the release/v1.37 commit
567847a5ed947b0ae3a6f10ecefb0b9ac8c17605, itself a cherry-pick of the main-branch commit 867251ab48bb4fda89ead154bbc600131cf614ad.
This is the 2nd attempt to fix
envoyproxy/envoy#41654.
The 1st attempt is envoyproxy/envoy#43042
The root cause of the issue is when the 2nd filter resume the processing,
doData(observedEndStream() && !had_trailers_before_data)insource/common/http/filter_manager.ccuses an outdatedobservedEndStream()flag asend_of_stream. This flag is set to true once Envoy sees data with end_of_stream set to true either from downstream client or backend server. However, in the ext_proc case, after the data with end_of_stream=true is received by Envoy, it is sent out to the side-stream server and re-injected back to Envoy, theobservedEndStream()flag has to be updated during re-injection. Otherwise, the 2nd filtercommonContinue()deems the full body is in buffer, i.e. end_of_stream=true, even the 1st filter is still injecting more data.The issue is reproduced in both ext_proc STREAMED and FULL_DUPLEX_STREAMED modes, also in both request and response directions. Please check the added integration tests.
Backport notes (changes needed to resolve conflicts against 1.35):
envoy.reloadable_features.ext_proc_inject_data_with_state_updateruntime guard applied cleanly; the unrelatedgeneric_proxy_codec_buffer_limitguard in the surrounding context does not exist on 1.35 and was dropped.ext_proc_integration_common.*,filter_test_common.*orext_proc_full_duplex_integration_test.cc. The new files the cherry-pick tried to add were dropped, and all test changes were ported into 1.35's monolithicext_proc_integration_test.ccandfilter_test.ccinstead: the runtime-guard override in the config setup, thetwo_ext_proc_filters_config path and its helpers (addDownstreamExtProcFilter,server1*gRPC helpers), the extractedinitializeConfigDuplexStreamed, and the three newTwoExtProcFilters*full-duplex tests plus the two STREAMED tests.ContainsHeadermatcher, so the ported tests use the equivalentSingleHeaderValueIsmatcher already imported in the file.DuplexStreamedServerResponseWithSynthesizedTrailertest is disabled (renamedDISABLED_*); it depends on behavior not present on 1.35.ext_proc_inject_data_with_state_updateruntime override.