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 issue with growing number of allocated direct buffers #8

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

kochkozharov
Copy link

@kochkozharov kochkozharov commented Dec 26, 2024

Example showing the problematic scenario is here in master branch: https://github.com/[kochkozharov/hadroNIO-memory-leak](https://github.com/kochkozharov/hadroNIO-memory-leak). It's pretty much the same as in my previous PR.
docker compose -f docker-compose.nofix.yml up --build
You can see unlimited growing number of off-heap buffers, which can cause OOM error or hang.
There are some charts from visualvm (shows memory usage and amount of direct buffers in taskmanager):
server_nofix
Same situation appears in jobmanager.
In this fix I suggest to implicitly free objects like new UnsafeBuffer(ByteBuffer.allocateDirect(Long.BYTES)) and replace direct buffer in callback with on-heap one.
Running the cluster with the changes:
docker compose up --build
Visualvm results in taskmanager:
server_fix
The number of direct buffers has been significantly reduced.

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