Skip to content

HTTPCLIENT-2428: adjust reactor capacity in inflating AsyncDataConsumers #860

Open
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:HTTPCLIENT-2428
Open

HTTPCLIENT-2428: adjust reactor capacity in inflating AsyncDataConsumers #860
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:HTTPCLIENT-2428

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Inflating consumers forwarded the downstream capacity (decompressed bytes) to the reactor unchanged, so decompression could expand it and overshoot the requested capacity.
They now wrap the CapacityChannel and scale the increment down by a fixed expansion factor before forwarding it.
InflatingBrotliDataConsumer also stops overriding the downstream capacity with Integer.MAX_VALUE, which defeated back-pressure.

@arturobernalg
arturobernalg requested a review from ok2c July 24, 2026 06:38

@Override
public void update(final int increment) throws IOException {
if (increment <= 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@arturobernalg I would also make a special check and pass Integer#MAX_VALUE along without expansion factor.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@ok2c Done. Integer.MAX_VALUE is now forwarded unchanged

…rs to match decompressed output

Inflating consumers now request proportionally fewer compressed bytes than the downstream consumer's advertised (decompressed) capacity, so decompression no longer overshoots it; InflatingBrotliDataConsumer also stops overriding the downstream capacity with Integer.MAX_VALUE.
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