apache / apache/rocketmq

[Bug] PopConsumerRocksdbStore leaks RocksDB Slice objects

Open Beginner friendly
#10,912 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

### Before Creating the Bug Report

- [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions).

- [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate.

- [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

### Runtime platform environment

All

### RocketMQ version

develop

### JDK Version

All

### Describe the Bug

`PopConsumerRocksdbStore.scanExpiredRecords()` creates two RocksDB Slice objects for iterator bounds without closing them, causing native memory leaks.

### Steps to Reproduce

1. Start a broker with POP consumption enabled.
2. Continuously trigger POP revive scanning.
3. Observe the broker process’s native memory usage over time.

### What Did You Expect to See?

The lower-bound and upper-bound Slice objects should be closed after each scan, keeping native memory usage stable.

### What Did You See Instead?

Each scan leaks two native Slice objects. Repeated revive scans may cause native memory usage to grow continuously.

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at PopConsumerRocksdbStore.scanExpiredRecords(), the entry point named in the report, and trace how its iterator bounds are created during POP revive scanning. Reproduce repeated scans with POP consumption enabled while watching native memory, then verify both RocksDB Slice objects are released after each scan and memory remains stable.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.