This is an automated email from the ASF dual-hosted git repository.

bbejeck pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new a31d93c4c2d KAFKA-20688: Fix RocksDB memory leak (#22557)
a31d93c4c2d is described below

commit a31d93c4c2dc322272181c383d3cb76fc973625c
Author: Matthias J. Sax <[email protected]>
AuthorDate: Mon Jun 15 06:53:59 2026 -0700

    KAFKA-20688: Fix RocksDB memory leak (#22557)
    
    openRocksDB() passed a `new ColumnFamilyOptions()` into a throwaway Options
    used only for listColumnFamilies; the try-with-resources closes the Options
    wrapper but not that ColumnFamilyOptions, leaking a native handle on every
    store open. Reuse the existing columnFamilyOptions parameter (already 
closed                                                                          
                                                      via RocksDBStore)
    
    Reviewers: Nilesh Kumar, Uladzislau Blok <[email protected]>, Bill
    Bejeck <[email protected]>
---
 .../streams/state/internals/RocksDBTimestampedStoreWithHeaders.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBTimestampedStoreWithHeaders.java
 
b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBTimestampedStoreWithHeaders.java
index 9a53c35290a..8f96b182916 100644
--- 
a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBTimestampedStoreWithHeaders.java
+++ 
b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBTimestampedStoreWithHeaders.java
@@ -73,7 +73,7 @@ public class RocksDBTimestampedStoreWithHeaders extends 
RocksDBStore implements
                      final ColumnFamilyOptions columnFamilyOptions) {
         // Check if we're upgrading from RocksDBTimestampedStore or from plain 
RocksDBStore
         final List<byte[]> existingCFs;
-        try (final Options options = new Options(dbOptions, new 
ColumnFamilyOptions())) {
+        try (final Options options = new Options(dbOptions, 
columnFamilyOptions)) {
             existingCFs = RocksDB.listColumnFamilies(options, 
dbDir.getAbsolutePath());
         } catch (final RocksDBException e) {
             throw new ProcessorStateException("Error listing column families 
for store " + name, e);

Reply via email to