[ISSUE #10912] Close RocksDB Slice objects in scanExpiredRecords - #10914
[ISSUE #10912] Close RocksDB Slice objects in scanExpiredRecords#10914123123213weqw wants to merge 1 commit into
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR contains the exact same fix as #10913 — both modify PopConsumerRocksdbStore.scanExpiredRecords() to properly close RocksDB Slice objects. The diffs are identical.
Recommendation: Since #10913 was submitted first (same date, earlier PR number), consider closing this one as a duplicate to avoid merge conflicts and reduce review burden on maintainers.
The underlying fix is correct — Slice objects must be explicitly closed to prevent native memory leaks.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review Summary
This PR fixes a resource leak in PopConsumerRocksdbStore.scanExpiredRecords where RocksDB Slice objects were not being properly closed.
Findings
- [Critical] PopConsumerRocksdbStore.java:147 — RocksDB
Sliceobjects implementCloseableand must be closed to prevent native memory leaks. The fix properly wraps them in try-with-resources. - [Info] This is a classic native memory leak pattern. Without proper cleanup, long-running brokers would gradually consume more off-heap memory.
Overall
Good fix for a resource leak. RocksDB objects hold native memory that won't be reclaimed by the JVM garbage collector, so explicit cleanup is essential.
Automated review by RockteMQ-AI
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Properly closes RocksDB Slice objects in scanExpiredRecords using try-with-resources. This fixes a native memory leak — Slice holds off-heap memory that won't be reclaimed by GC.
Clean fix, LGTM.
Automated review by github-manager-bot
What is the purpose of the change
Fix #10912.
scanExpiredRecords() created two RocksDB Slice objects as iterator bounds and never closed them, leaking native memory on every POP revive scan. The slices are now created as named resources inside the try-with-resources block so they are closed together with the ReadOptions and iterator.
Brief changelog
How was this patch verified