Skip to content

[ISSUE #10912] Fix native memory leak in PopConsumerRocksdbStore - #10913

Open
majialoong wants to merge 1 commit into
apache:developfrom
majialoong:ISSUE-10912
Open

[ISSUE #10912] Fix native memory leak in PopConsumerRocksdbStore#10913
majialoong wants to merge 1 commit into
apache:developfrom
majialoong:ISSUE-10912

Conversation

@majialoong

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Brief Description

Close the RocksDB Slice objects created in scanExpiredRecords() to prevent native memory leaks.

How Did You Test This Change?

Ran the existing PopConsumerRocksdbStoreTest and verified that native memory remains stable during repeated scans.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.35%. Comparing base (97a7975) to head (b2f2cd7).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10913      +/-   ##
=============================================
- Coverage      48.46%   48.35%   -0.12%     
+ Complexity     13584    13553      -31     
=============================================
  Files           1380     1380              
  Lines         101195   101197       +2     
  Branches       13130    13130              
=============================================
- Hits           49040    48929     -111     
- Misses         46188    46279      +91     
- Partials        5967     5989      +22     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

This PR fixes a native memory leak in PopConsumerRocksdbStore.scanExpiredRecords() by properly closing RocksDB Slice objects in a try-with-resources block.

The fix is correct — Slice objects hold native (off-heap) memory via RocksDB's C++ layer and must be explicitly closed. Previously, they were created inline inside ReadOptions and never released, causing a native memory leak under sustained pop-consume traffic.

LGTM. Clean, minimal fix.


Automated review by github-manager-bot

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.

[Bug] PopConsumerRocksdbStore leaks RocksDB Slice objects

3 participants