Skip to content
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

Fix stream backpressure when compressing #11115

Merged
merged 1 commit into from
Aug 26, 2024
Merged

Fix stream backpressure when compressing #11115

merged 1 commit into from
Aug 26, 2024

Conversation

yawkat
Copy link
Member

@yawkat yawkat commented Aug 26, 2024

When compression is on, writeCompressing will immediately advance the buffer position, so buf.readableBytes() would be 0 and backpressure would not be relieved properly.

Fixes #11114

When compression is on, writeCompressing will immediately advance the buffer position, so `buf.readableBytes()` would be 0 and backpressure would not be relieved properly.

Fixes #11114
@yawkat yawkat added the type: bug Something isn't working label Aug 26, 2024
@yawkat yawkat added this to the 4.6.4 milestone Aug 26, 2024
Copy link

@@ -58,6 +59,7 @@ public final class InputStreamBodyWriter extends AbstractFileBodyWriter implemen

@Override
public void writeTo(HttpRequest<?> request, MutableHttpResponse<InputStream> outgoingResponse, Argument<InputStream> type, MediaType mediaType, InputStream object, NettyWriteContext nettyContext) throws CodecException {
outgoingResponse.getHeaders().setIfMissing(HttpHeaderNames.CONTENT_TYPE, mediaType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if mediaType is not null

@graemerocher graemerocher merged commit 1f291e0 into 4.6.x Aug 26, 2024
17 checks passed
@graemerocher graemerocher deleted the stream-size branch August 26, 2024 11:39
altro3 pushed a commit to altro3/micronaut-core that referenced this pull request Aug 31, 2024
When compression is on, writeCompressing will immediately advance the buffer position, so `buf.readableBytes()` would be 0 and backpressure would not be relieved properly.

Fixes micronaut-projects#11114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Micronaut 4.6.x: Static resources loading is broken
3 participants