Skip to content

KAFKA-19483 : storage : Fix resource leak, cleanup#21964

Open
muralibasani wants to merge 1 commit intoapache:trunkfrom
muralibasani:KAFKA-19483
Open

KAFKA-19483 : storage : Fix resource leak, cleanup#21964
muralibasani wants to merge 1 commit intoapache:trunkfrom
muralibasani:KAFKA-19483

Conversation

@muralibasani
Copy link
Copy Markdown
Contributor

@muralibasani muralibasani commented Apr 4, 2026

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

Fixes below issues.

  • There is a resource leak in closeQuietly
  • Add a waitForCondition in testConcurrentCacheDeletedFileExists to wait for all pending tasks are completed
  • testDeleteInvalidIndexFilesOnInit wrapped with try/resources. There is a resource leak in new RemoteIndexCache.. which was not closed earlier.

@github-actions github-actions bot added triage PRs from the community tests Test fixes (including flaky tests) storage Pull requests that target the storage module small Small PRs labels Apr 4, 2026
@muralibasani muralibasani changed the title KAFKA-19483 : Fix resource leak, cleanup KAFKA-19483 : storage : Fix resource leak, cleanup Apr 5, 2026
@muralibasani
Copy link
Copy Markdown
Contributor Author

@Shekharrajak would you like to take a look ?

Copy link
Copy Markdown

@Shekharrajak Shekharrajak left a comment

Choose a reason for hiding this comment

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

The test testDeleteInvalidIndexFilesOnInit uses the same logDir for the secondCache as the primary cache field. Since both caches share the same directory, the secondCache.close() in the try-with-resources will shut down the second cache's cleaner, but if it also affects files that the primary cache relies on, there could be interference. Looking at the test, it creates separate rlsMetadata with baseOffset + 100, so the index files should be distinct. This looks safe.


// Wait for all scheduled cleanup tasks to complete so the cleaner thread is idle before @AfterEach
// shuts it down. This prevents a race between an in-flight task and scheduler shutdown.
TestUtils.waitForCondition(() -> cache.expiredIdxPendingForDeletion() == 0,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍🏼

@github-actions github-actions bot removed the triage PRs from the community label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small Small PRs storage Pull requests that target the storage module tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants