rocketmq
rocketmq copied to clipboard
[Bug] Invalid key/value in long polling is not removed from Map
Before Creating the Bug Report
-
[X] I found a bug, not just asking a question, which should be created in GitHub Discussions.
-
[X] I have searched the GitHub Issues and GitHub 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
mac
RocketMQ version
master
JDK Version
jdk1.8
Describe the Bug
Invalid Consumer data in org.apache.rocketmq.broker.longpolling.PullRequestHoldService#pullRequestTable
will not be removed
Steps to Reproduce
- Start Broker
- Create a Topic and send a message
- Start Consumer. When the pull message returns
ResponseCode.PULL_NOT_FOUND
, it will be added toorg.apache.rocketmq.broker.longpolling.PullRequestHoldService#pullRequestTable
- But when the
Consumer
is stopped, the data inorg.apache.rocketmq.broker.longpolling.PullRequestHoldService#pullRequestTable
still exists
What Did You Expect to See?
After Consumer
is stopped, the matching data in org.apache.rocketmq.broker.longpolling.PullRequestHoldService#pullRequestTable
is removed
What Did You See Instead?
After Consumer
is stopped, the matching data in org.apache.rocketmq.broker.longpolling.PullRequestHoldService#pullRequestTable
is still there
Additional Context
We should remove key
under the condition that null == mpr || null == mpr.cloneListAndClear()
Hi @RongtongJin , please help check it.
这个未删除的问题会带来哪些影响呢
There may be problems in the following aspects:
- org.apache.rocketmq.broker.longpolling.PullRequestHoldService#pullRequestTable is getting larger and larger, which may lead to insufficient memory or even OOM
- Useless traversal and useless acquisition getMaxOffsetInQueue
@lizhanhui What you think?