Repository navigation
Fix compression dropping gRPC status trailers - #685
Merged
Merged
Conversation
seanmonstar
approved these changes
May 22, 2026
seanmonstar
added a commit
that referenced
this pull request
Jul 13, 2026
This is a regression introduced in #685. While trailers frames should be forwarded, they already were. Extra data frames after decompression is complete is a body error.
1 task done
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.
Closes #546
Motivation
When
CompressionLayeris applied to a gRPC (or grpc-web) service, response trailers containinggrpc-statusandgrpc-messagecan be dropped. The client receives an empty trailers frame and errors with "server closed the stream without sending trailers." This became more impactful after #408 enabled compression forapplication/grpc-webresponses.Solution
The root cause is a regression in the
WrapBody::poll_frametrailer-forwarding logic introduced by #618 . After the compression encoder finishes, the code polls the inner body for remaining frames (trailers). The regression changed this section to only forward frames passingis_trailers(), returningNonefor any other frame type. This could terminate the body early before trailers were delivered.The fix simplifies the post-compression section to forward all frames from the inner body unconditionally, matching the original behavior from v0.6.2. This is safe because after the encoder returns EOF, any remaining frames from the inner body are either trailers or should be passed through to the caller regardless.
Added regression tests covering trailer preservation through compression for empty bodies (common gRPC error responses), streamed multi-chunk bodies, and
application/grpc-webcontent type responses.