fix(ChunkedOutputFilter): reset position chunks buffer when recycled - #1058
Open
choijunwoo wants to merge 2 commits into
Open
fix(ChunkedOutputFilter): reset position chunks buffer when recycled#1058choijunwoo wants to merge 2 commits into
choijunwoo wants to merge 2 commits into
Conversation
choijunwoo
force-pushed
the
fix-checked-output-filter
branch
from
September 7, 2026 06:14
0a209a0 to
bc9926c
Compare
choijunwoo
force-pushed
the
fix-checked-output-filter
branch
from
September 8, 2026 04:28
bc9926c to
ab0b860
Compare
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.
Problem
ChunkedOutputFilterreuses thelastChunk,crlfChunk, andendChunkByteBufferinstances across responses.The
end()method resets these buffers only after the corresponding downstreamwrite completes successfully. If
HttpOutputBuffer.doWrite()consumes part of abuffer and then throws an
IOException, the reset is skipped.When the owning
Http11Processoris subsequently recycled, the sameChunkedOutputFiltermay be reused with the stale buffer position. For example,if the first two bytes (
0\r) of the terminal chunk (0\r\n\r\n) were consumedbefore the exception, the next response would write only the remaining
\n\r\n.Fix
Reset the position to zero and the limit to the capacity for all reusable chunk
buffers in
ChunkedOutputFilter.recycle():lastChunkcrlfChunkendChunkThis mirrors the reset already performed after successful writes while also
covering exceptional write paths.