Skip to content

Fix HoodieStorage resource leak in FileSystemBasedLockProvider.close()#18461

Open
mailtoboggavarapu-coder wants to merge 1 commit intoapache:masterfrom
mailtoboggavarapu-coder:fix/filesystem-lock-provider-storage-leak
Open

Fix HoodieStorage resource leak in FileSystemBasedLockProvider.close()#18461
mailtoboggavarapu-coder wants to merge 1 commit intoapache:masterfrom
mailtoboggavarapu-coder:fix/filesystem-lock-provider-storage-leak

Conversation

@mailtoboggavarapu-coder
Copy link
Copy Markdown

Problem

FileSystemBasedLockProvider creates a HoodieStorage instance in its constructor but never closes it in the close() method. Since HoodieStorage implements Closeable and holds underlying filesystem connections, this causes a resource leak every time the lock provider is closed.

Solution

Add a finally block inside close() to ensure storage.close() is always called after the lock file deletion attempt, regardless of whether deletion succeeds or throws an exception. IOException from storage.close() is caught and logged as a warning to avoid masking the original exception.

Changes

  • FileSystemBasedLockProvider.java: Added finally block in close() to call storage.close() with proper exception handling.

@github-actions github-actions bot added the size:XS PR with lines of changes in <= 10 label Apr 3, 2026
@hudi-bot
Copy link
Copy Markdown
Collaborator

hudi-bot commented Apr 3, 2026

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS PR with lines of changes in <= 10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants