Skip to content

fix: release buffered response bytes in AppendableByteArrayInputStream - #20521

Open
kgyrtkirk wants to merge 1 commit into
apache:masterfrom
kgyrtkirk:appendable-stream-release
Open

kgyrtkirk wants to merge 1 commit into
apache:masterfrom
kgyrtkirk:appendable-stream-release

Conversation

@kgyrtkirk

Copy link
Copy Markdown
Member

No description provided.

@FrankChen021 FrankChen021 left a comment

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.

🟢 Approval recommended

No actionable issues found. Closing or failing the stream releases queued response arrays and rejects subsequent chunks; blocked readers are notified, and the currently consumed chunk retains the explicitly tested behavior. The widened byte count and saturated available() result avoid integer overflow, and the guarded decrement preserves zero accounting after concurrent failure or close.

Reviewed 2 of 2 changed files, including the stream implementation and its tests, plus the surrounding HTTP response handlers and relevant consumers.

Validation: git diff --check against the prepared merge base passed. Static review only; no tests or builds were run.


This is an automated review by Codex GPT-5.6-Luna(max)


Assertions.assertEquals(Integer.MAX_VALUE, in.available());

in.read(new byte[oneMebibyte.length]);
Assertions.assertEquals(0, in.available());
Assertions.assertEquals(5, in.read(new byte[5]), "the chunk being read is still handed out");
Assertions.assertEquals(0, in.available());
Assertions.assertThrows(IOException.class, () -> in.read(new byte[8192]));
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.

3 participants