Skip to content

Conversation

@jeqo
Copy link
Contributor

@jeqo jeqo commented Jan 9, 2026

Fix resource management issues in three Inkless storage components:

  1. FileCommitter: Add missing shutdown of executorServiceCacheStore in close(). Previously 8 threads (default config) were leaking on every broker shutdown cycle.

  2. DeleteRecordsInterceptor: Implement Closeable interface for proper cleanup. Changed from generic Executor to ExecutorService for proper shutdown control, added InklessThreadFactory for consistent thread naming, and uses ThreadUtils.shutdownExecutorServiceQuietly() with 5-second timeout.

  3. FetchOffsetHandler: Improve executor shutdown with proper timeout handling. Changed from shutdown() to shutdownExecutorServiceQuietly() to ensure graceful termination with 5-second timeout, matching the pattern used in Reader component.

All components now properly implement resource cleanup, preventing thread leaks during normal broker lifecycle operations.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes thread pool resource leaks in three Inkless storage components by ensuring proper shutdown of all ExecutorService instances during broker lifecycle operations.

Key Changes:

  • Added missing shutdown call for executorServiceCacheStore in FileCommitter, preventing leak of 8 threads per broker shutdown
  • Implemented Closeable interface for DeleteRecordsInterceptor with proper ExecutorService shutdown using 5-second timeout
  • Improved FetchOffsetHandler shutdown from basic shutdown() to shutdownExecutorServiceQuietly() with 5-second timeout

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
storage/inkless/src/main/java/io/aiven/inkless/produce/FileCommitter.java Added missing executorServiceCacheStore.shutdown() call and documentation about thread pool lifecycle
storage/inkless/src/test/java/io/aiven/inkless/produce/FileCommitterTest.java Added verification for executorServiceCacheStore shutdown
storage/inkless/src/main/java/io/aiven/inkless/delete/DeleteRecordsInterceptor.java Implemented Closeable, changed Executor to ExecutorService, added InklessThreadFactory for thread naming, and proper shutdown with timeout
storage/inkless/src/test/java/io/aiven/inkless/delete/DeleteRecordsInterceptorTest.java Added close() calls to all tests and new test verifying shutdown behavior
storage/inkless/src/main/java/io/aiven/inkless/consume/FetchOffsetHandler.java Changed to shutdownExecutorServiceQuietly with timeout, refactored constructor for testability
storage/inkless/src/test/java/io/aiven/inkless/consume/FetchOffsetHandlerTest.java Added test verifying proper executor shutdown with timeout
storage/inkless/src/main/java/io/aiven/inkless/produce/Writer.java Added documentation about thread pool lifecycle management
storage/inkless/src/main/java/io/aiven/inkless/consume/Reader.java Added documentation about thread pool lifecycle management
core/src/main/scala/kafka/server/ReplicaManager.scala Added close() call for inklessDeleteRecordsInterceptor in shutdown sequence

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Fix resource management issues in three Inkless storage components:

1. FileCommitter: Add missing shutdown of executorServiceCacheStore
   in close(). Previously 8 threads (default config) were leaking on
   every broker shutdown cycle.

2. DeleteRecordsInterceptor: Implement Closeable interface for proper
   cleanup. Changed from generic Executor to ExecutorService for proper
   shutdown control, added InklessThreadFactory for consistent thread
   naming, and uses ThreadUtils.shutdownExecutorServiceQuietly() with
   5-second timeout.

3. FetchOffsetHandler: Improve executor shutdown with proper timeout
   handling. Changed from shutdown() to shutdownExecutorServiceQuietly()
   to ensure graceful termination with 5-second timeout, matching the
   pattern used in Reader component.

All components now properly implement resource cleanup, preventing
thread leaks during normal broker lifecycle operations.
@jeqo jeqo force-pushed the jeqo/refactor-thread-pools branch from 2458994 to 89571b9 Compare January 9, 2026 11:39
@jeqo jeqo requested a review from Copilot January 9, 2026 12:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants