Skip to content

KAFKA-19390: Call AbstractIndex.safeForceUnmap() in AbstractIndex.resize() on Linux to prevent stale index file memory mappings #19961

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

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

Forest0923
Copy link

https://issues.apache.org/jira/browse/KAFKA-19390

The AbstractIndex.resize() method does not release the old memory map for both index and time index files.
In some cases, Mixed GC may not run for a long time, which can cause the broker to crash when the vm.max_map_count limit is reached.

The root cause is that safeForceUnmap() is not being called on Linux within resize(), so we have changed the code to unmap old mmap on all operating systems.

The same problem was reported in KAFKA-7442, but the PR submitted at that time did not acquire all necessary locks around the mmap accesses and was closed without fixing the issue.

@github-actions github-actions bot added triage PRs from the community core Kafka Broker storage Pull requests that target the storage module labels Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Kafka Broker storage Pull requests that target the storage module triage PRs from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant