RockteMQ-AI commented on issue #10912:
URL: https://github.com/apache/rocketmq/issues/10912#issuecomment-5269324296

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed**
   
   The reported native memory leak is verified in the current `develop` branch.
   
   **Root Cause:** In `PopConsumerRocksdbStore.scanExpiredRecords()` (line 
150–152), two `org.rocksdb.Slice` objects are created inline as arguments to 
`ReadOptions.setIterateLowerBound()` / `setIterateUpperBound()` but are never 
closed. `Slice` holds a native (C++) pointer via JNI and implements 
`Closeable`; failing to call `close()` leaks native memory on every invocation.
   
   **Affected Code:**
   ```java
   // 
broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.java
   try (ReadOptions scanOptions = new ReadOptions()
       .setIterateLowerBound(new Slice(...))   // ← never closed
       .setIterateUpperBound(new Slice(...))); // ← never closed
   ```
   
   **Impact:** Each POP revive scan leaks two native `Slice` allocations. Under 
sustained POP consumption traffic, native memory (off-heap) grows continuously, 
which can eventually trigger OOM-kill of the Broker process.
   
   **Severity:** Medium-High — affects any deployment using POP consumption 
with RocksDB-backed revive scanning.
   
   **Suggested Fix:** Extract the `Slice` objects into local variables and 
close them in a `finally` block or nested try-with-resources.
   
   An automated fix proposal can be generated. Reply `/approve` to proceed with 
PR generation.
   
   ---
   *Automated evaluation by github-manager-bot*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to