tju-yxq opened a new issue, #1401:
URL: https://github.com/apache/rocketmq-dashboard/issues/1401

   ## Bug Report
   
   ### 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
   
   OS: Ubuntu 20.04 / Any OS running RocketMQ Studio
   
   ### RocketMQ version
   
   branch: rocketmq-studio
   version: 5.3.2+
   Git commit id: f727341
   
   ### JDK Version
   
   OpenJDK 21
   
   ### Describe the Bug
   
   There are **three separate** `isSystemGroup` / `isSystemConsumerGroup` 
implementations in the codebase with **inconsistent** filtering rules. System 
consumer groups that should be hidden from users appear in the topic consumers 
list and dashboard because the `RocketMQMetadataProvider` implementation is 
missing several system group prefixes.
   
   **Implementation comparison:**
   
   | Prefix/Pattern | `RocketMQClientProvider.isSystemGroup` | 
`RocketMQMetadataProvider.isSystemConsumerGroup` | 
`RocketMQDashboardProvider.isSystemGroup` |
   |---|---|---|---|
   | `CID_RMQ_SYS_` | prefix | prefix | prefix |
   | `%RETRY%` | prefix | prefix | **missing** |
   | `%DLQ%` | missing | prefix | **missing** |
   | `CID_ONSAPI_` | prefix | **bug**: checks `CID_ONS_` which does NOT match 
`CID_ONSAPI_` | partial: exact match only for 3 specific names |
   | `CID_SYS_` | prefix | **missing** | **missing** |
   | `TOOLS_CONSUMER` | prefix | prefix | exact |
   | `FILTERSRV_CONSUMER` | prefix | prefix | exact |
   | `SELF_TEST_` | prefix | **missing** | prefix |
   | `CID_HOUSEKEEPING` | prefix | **missing** | **missing** |
   | `rmq_sys_` | missing | missing | prefix |
   
   **Impact:**
   
   - `RocketMQMetadataProvider.isSystemConsumerGroup` is used by 
`getTopicConsumers()` to filter which consumer groups appear in the topic 
detail page. Because it checks `CID_ONS_` instead of `CID_ONSAPI_`, system 
groups like `CID_ONSAPI_OWNER`, `CID_ONSAPI_PERMISSION`, and `CID_ONSAPI_PULL` 
are **not filtered** and appear in the topic consumers list. Similarly, 
`CID_SYS_*`, `SELF_TEST_*`, and `CID_HOUSEKEEPING` groups leak through.
   
   - `RocketMQDashboardProvider.isSystemGroup` is used to count non-system 
groups for the dashboard overview. Because it does not filter `%RETRY%`, 
`%DLQ%`, `CID_SYS_`, or `CID_HOUSEKEEPING`, the total consumer group count on 
the dashboard is **inflated** with system groups.
   
   - The `CID_ONS_` vs `CID_ONSAPI_` discrepancy is particularly insidious: 
`startsWith("CID_ONS_")` does NOT match `"CID_ONSAPI_OWNER"` because the 
underscore is part of the prefix.
   
   ### Steps to Reproduce
   
   1. Start a RocketMQ cluster with ONS (cloud messaging) integration or any 
cluster that creates `CID_ONSAPI_*` system groups.
   2. Create a topic and produce messages.
   3. Open RocketMQ Studio, navigate to the topic detail page.
   4. Observe: the "Consumers" tab shows system groups like `CID_ONSAPI_OWNER` 
that should be hidden.
   5. Open the dashboard overview.
   6. Observe: the total consumer group count includes system groups like 
`%RETRY%` and `CID_HOUSEKEEPING`.
   
   ### What Did You Expect to See?
   
   System consumer groups should be consistently filtered across all three 
providers using the same set of prefixes and patterns. The topic consumers list 
and dashboard should not show or count system groups.
   
   ### What Did You See Instead?
   
   System groups like `CID_ONSAPI_OWNER` appear in the topic consumers list, 
and the dashboard group count includes system groups like `%RETRY%`.
   
   ### Additional Context
   
   **Affected files**:
   - 
`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQMetadataProvider.java`
 - `isSystemConsumerGroup()` at approximately line 390
   - 
`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQDashboardProvider.java`
 - `isSystemGroup()` at approximately line 230
   - 
`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQClientProvider.java`
 - `isSystemGroup()` (reference implementation, most complete)
   
   **Fix approach**:
   
   Extract a shared static utility method that consolidates all system group 
patterns from the three implementations into a single, authoritative list:
   
   ```java
   public static boolean isSystem(String group) {
       if (group == null || group.isEmpty()) return true;
       return group.startsWith("CID_RMQ_SYS_")
               || group.startsWith("CID_ONSAPI_")
               || group.startsWith("CID_SYS_")
               || group.startsWith("CID_HOUSEKEEPING")
               || group.startsWith("rmq_sys_")
               || group.startsWith("%RETRY%")
               || group.startsWith("%DLQ%")
               || group.startsWith("TOOLS_CONSUMER")
               || group.startsWith("FILTERSRV_CONSUMER")
               || group.startsWith("SELF_TEST_");
   }
   ```
   
   Then replace all three implementations with calls to this shared method. 
This adds approximately 20 lines (the utility class) and modifies 3 files to 
use it, totaling ~35 lines of changes with no logic deletion.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to