Skip to content

[RESTEASY-3670] Prevent off-heap OOME with chunked entity file writes#4735

Merged
jamezp merged 1 commit into
resteasy:mainfrom
jamezp:RESTEASY-3670
Nov 14, 2025
Merged

[RESTEASY-3670] Prevent off-heap OOME with chunked entity file writes#4735
jamezp merged 1 commit into
resteasy:mainfrom
jamezp:RESTEASY-3670

Conversation

@jamezp

@jamezp jamezp commented Nov 12, 2025

Copy link
Copy Markdown
Member

Introduces chunked writing for entity output streams to prevent large DirectByteBuffer allocations when writing large POST request entities to temporary files. The default buffer size of 8KB prevents the NIO layer from allocating large thread-local buffers that can exhaust off-heap memory with small MaxDirectMemorySize settings.

https://issues.redhat.com/browse/RESTEASY-3670

Introduces chunked writing for entity output streams to prevent large
DirectByteBuffer allocations when writing large POST request entities
to temporary files. The default buffer size of 8KB prevents the NIO
layer from allocating large thread-local buffers that can exhaust
off-heap memory with small MaxDirectMemorySize settings.

https://issues.redhat.com/browse/RESTEASY-3670
Signed-off-by: James R. Perkins <jperkins@ibm.com>
@jamezp jamezp requested a review from a team as a code owner November 12, 2025 22:04
@jamezp jamezp merged commit 8d4b1b7 into resteasy:main Nov 14, 2025
13 checks passed
Sgitario added a commit to RedHatInsights/rhsm-subscriptions that referenced this pull request Feb 16, 2026
Jira issue: SWATCH-4569

## Description
The issue is happening only when trying to upload larger files than 1 MB
and causes the consumer to stop working (consuming more messages from
the topic).

This is caused by the changes in
resteasy/resteasy#4735 which introduced
ClientEntityOutputStream$PathHttpEntity which has a visibility class bug
when trying to instantiate EntityInputStream. I reported the issue by
RESTEASY-3691.

These changes reproduce the issue and downgrade the resteasy version to
7.0.0.

## Testing
Reproduced via unit tests.
To reproduce the test manually, you would need to request a report
larger than 1 MB.
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.

1 participant