apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.
https://rocketmq.apache.org/
Apache License 2.0
21.19k stars 11.67k forks source link

[Bug] Some statistical items should also be deleted to prevent memory leakage when a topic or group is deleted #8463

Closed RongtongJin closed 2 months ago

RongtongJin commented 2 months ago

Before Creating the Bug Report

Runtime platform environment

All platform

RocketMQ version

5.x

JDK Version

All JDK version

Describe the Bug

The previous issue is #8432, but after enabling autoDeleteUnusedStats, a small number of metrics still experienced leaks. It was eventually discovered that some metric items were overlooked during the deletion of Topics or Groups.

Steps to Reproduce

The frequent creation and deletion of topics and groups, while also sending and receiving messages.

What Did You Expect to See?

No memory leakage

What Did You See Instead?

Memory leakage

Additional Context

No

yx9o commented 2 months ago

I used mqtt in version 4.9.8 and also found memory leaks. https://github.com/apache/rocketmq-mqtt/issues/287

RongtongJin commented 2 months ago

I used mqtt in version 4.9.8 and also found memory leaks. apache/rocketmq-mqtt#287

The issue indeed exists; is there a solution to fix it?

yx9o commented 2 months ago

I used mqtt in version 4.9.8 and also found memory leaks. apache/rocketmq-mqtt#287

The issue indeed exists; is there a solution to fix it?

I can think of two possible solutions:

  1. Change rmq and add a scheduled task. Because the client changes on the mqtt side cannot be sensed, the lmq-related ones can only be removed mindlessly on a scheduled basis
  2. Change mqtt. When the client goes offline and disconnects, notify the broker to remove it (recommended)
RongtongJin commented 1 month ago

I used mqtt in version 4.9.8 and also found memory leaks. apache/rocketmq-mqtt#287

The issue indeed exists; is there a solution to fix it?

I can think of two possible solutions:

  1. Change rmq and add a scheduled task. Because the client changes on the mqtt side cannot be sensed, the lmq-related ones can only be removed mindlessly on a scheduled basis
  2. Change mqtt. When the client goes offline and disconnects, notify the broker to remove it (recommended)

I also think the second option is better. It may be necessary to adapt the new interface to clean up the resources of the lmq queue, or directly implement it in the deleteTopic and deleteSubscriptionGroup methods.