Repository navigation
Conversation
Contributor
Author
|
/retest |
rblaze
force-pushed
the
local_replies
branch
2 times, most recently
from
November 9, 2026 18:43
387df02 to
17b72fe
Compare
When a decoder filter aborts the chain with `sendLocalReply`, `FilterManager::decodeHeaders` and `FilterManager::decodeTrailers` ran the prepared local reply before finishing that filter's bookkeeping (`processed_headers_`, the after-callback handling, and `decodeComplete()`). Running the prepared local reply can complete the stream synchronously and destroy the filters, so the old order could call `decodeComplete()` on a filter after `onDestroy()`. The downstream HCM hits this today: a filter local reply in `decodeHeaders(end_stream=true)` that ends the stream got `decodeComplete()` after `onDestroy()`. `HttpConnectionManagerImplTest.FilterHeadReply` encoded that order and is updated. The filter's bookkeeping now finishes before `executeLocalReplyIfPrepared()` runs, and iteration returns right after it. `decodeData` already had the safe order. `decodeComplete()` in the abort branch of `decodeHeaders` is also guarded by `!state_.destroyed_`, so aborts that tear the stream down synchronously inside `decodeHeaders` (for example `ContinueAndResetStream`, a direct local reply after response headers, or `resetStream()`) do not call into a destroyed filter either. In `decodeHeaders`, the early return now also covers the terminal decoder filter (on the downstream path, router local replies such as "no route" or "no healthy upstream"), which used to fall through to the end of `decodeHeaders`, as non-terminal filters already did. In `decodeTrailers`, the early return is new for every aborting filter, terminal or not. Both skip work that is not needed after a local reply: - the pass over metadata the filter added before the local reply. This was already a no-op, since `decodeMetadata` stops on an aborted chain and the pass only cleared the added metadata; - the trailing `disarmRequestTimeout()`, which ran a second time because encoding the local reply headers already disarms the request timeout; - in `decodeHeaders`, the trailing `maybeEndDecode()`, which only marks the decoder chain complete. A stream whose decoder chain was aborted is closed once encoding finishes, the same as a completed one. The "iteration aborted" trace log in `decodeTrailers` now comes before the local reply runs, as in `decodeHeaders`. Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
rblaze
marked this pull request as ready for review
November 9, 2026 20:09
Contributor
Author
|
/retest |
Contributor
Author
|
/assign @paul-r-gall |
paul-r-gall
reviewed
Nov 12, 2026
Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
Contributor
Author
|
Addressed the comments and did similar changes in another place. PTAL. |
Contributor
Author
|
/retest |
Contributor
|
please merge main, thanks. |
Signed-off-by: Andrey Sverdlichenko <blazered@google.com> # Conflicts: # source/common/http/filter_manager.cc # test/common/http/filter_manager_test.cc
…decodeData. Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
…n local reply. Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
…ing. Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
Contributor
Author
|
/retest |
paul-r-gall
reviewed
Nov 17, 2026
…t helpers. Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
paul-r-gall
previously approved these changes
Nov 17, 2026
Contributor
|
/assign-from envoyproxy/senior-maintainers |
|
envoyproxy/senior-maintainers assignee is @nezdolik |
Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
Contributor
Author
|
/retest |
Signed-off-by: Andrey Sverdlichenko <blazered@google.com>
This branch has not been deployed
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.
Commit Message: http: fix decoder filter local reply abort lifecycle in FilterManager.
Additional Description: This is the first pull request in the chain that makes local replies from upstream HTTP filters retriable.
When a decoder filter aborts the chain with sendLocalReply, FilterManager::decodeHeaders ran the prepared local reply before finishing that filter's bookkeeping (processed_headers_, commonHandleAfterHeadersCallback(), and decodeComplete()), and FilterManager::decodeTrailers ran it before commonHandleAfterTrailersCallback(). Running the prepared local reply can complete the stream synchronously and destroy the filters, so decodeHeaders could call decodeComplete() on a filter after onDestroy(). The downstream HCM hits this today: a filter local reply in decodeHeaders(end_stream=true) that ends the stream got decodeComplete() after onDestroy(). HttpConnectionManagerImplTest.FilterHeadReply encoded that order and is updated.
Each filter's bookkeeping now finishes before executeLocalReplyIfPrepared() runs, and iteration returns right after it:
In decodeHeaders and decodeTrailers, the early return from the abort block now also covers the terminal decoder filter (which previously fell through to the end of both methods, whereas non-terminal filters already returned early) and removes the dead maybeContinueDecoding() calls on an already-aborted chain in decodeHeaders. Before returning, decodeHeaders and decodeData (when end_stream is set) and decodeTrailers still call disarmRequestTimeout() if !state_.destroyed_ and response headers have not been set, so aborts that do not encode local reply headers (such as graceful sendGoAwayAndClose) still disarm the request timeout on a completed request without disarming twice on local replies. Returning early on an aborted chain also skips:
The "iteration aborted" trace log in decodeData and decodeTrailers now comes before the local reply runs, as in decodeHeaders.
The code in this PR is AI-generated (JetSki, Antigravity)
Risk Level: low
Testing: unit tests
Docs Changes: no
Release Notes: no
Platform Specific Features: no
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]