Skip to content

Merge commit from fork#15612

Merged
normanmaurer merged 1 commit into4.1from
decompress41
Sep 3, 2025
Merged

Merge commit from fork#15612
normanmaurer merged 1 commit into4.1from
decompress41

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:

We should ensure our decompressing decoders will fire their buffers through the pipeliner as fast as possible and so allow the user to take ownership of these as fast as possible. This is needed to reduce the risk of OOME as otherwise a small input might produce a large amount of data that can't be processed until all the data was decompressed in a loop. Beside this we also should ensure that other handlers that uses these decompressors will not buffer all of the produced data before processing it, which was true for HTTP and HTTP2.

Modifications:

  • Adjust affected decoders (Brotli, Zstd and ZLib) to fire buffers through the pipeline as soon as possible
  • Adjust HTTP / HTTP2 decompressors to do the same
  • Add testcase.

Result:

Less risk of OOME when doing decompressing

Motivation:

We should ensure our decompressing decoders will fire their buffers through the pipeliner as fast as possible and so allow the user to take ownership of these as fast as possible. This is needed to reduce the risk of OOME as otherwise a small input might produce a large amount of data that can't be processed until all the data was decompressed in a loop. Beside this we also should ensure that other handlers that uses these decompressors will not buffer all of the produced data before processing it, which was true for HTTP and HTTP2.

Modifications:

- Adjust affected decoders (Brotli, Zstd and  ZLib) to fire buffers through the pipeline as soon as possible
- Adjust HTTP / HTTP2 decompressors to do the same
- Add testcase.

Result:

Less risk of OOME when doing decompressing

Co-authored-by: yawkat <jonas.konrad@oracle.com>
@normanmaurer normanmaurer added this to the 4.1.125.Final milestone Sep 3, 2025
@normanmaurer normanmaurer merged commit 34894ac into 4.1 Sep 3, 2025
13 of 16 checks passed
@normanmaurer normanmaurer deleted the decompress41 branch September 3, 2025 08:35
Comment on lines -161 to -172
try {
Http2LocalFlowController flowController = connection.local().flowController();
decompressor.incrementDecompressedBytes(padding);
for (;;) {
ByteBuf nextBuf = nextReadableBuf(channel);
boolean decompressedEndOfStream = nextBuf == null && endOfStream;
if (decompressedEndOfStream && channel.finish()) {
nextBuf = nextReadableBuf(channel);
decompressedEndOfStream = nextBuf == null;
}

decompressor.incrementDecompressedBytes(buf.readableBytes());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@normanmaurer Here where previously padding was incrementDecompressedBytes but later on removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants