apache / apache/rocketmq-dashboard

[Studio][Bug] Client connection listing returns 502 when every consumer group is offline

Open
#4,006 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 14h
Merged PRs (30d)
58

Description

## Problem

The Clients page (`GET /api/clients`) fails with HTTP 502 "Failed to query consumer connections from all groups" whenever every non-system consumer group of the instance is offline — a normal state (consumer applications stopped, dev/test cluster, nightly windows) — instead of returning an empty connection list. The producer connections already collected in the same request are discarded too. The explicit producer-group lookup (`GET /api/producer/connection?...&producerGroup=G`) fails the same way for an offline group.

## Evidence

`rocketmq-tools` 5.5.0 (pinned by `server/pom.xml`), verified via `javap -c` on `DefaultMQAdminExtImpl`:

- `examineConsumerConnectionInfo(String)` throws `new MQClientException(206, "Not found the consumer group connection")` when `ConsumerConnection.getConnectionSet().isEmpty()`.
- `examineProducerConnectionInfo(String, String)` throws `new MQClientException("Not found the producer group connection", null)` for an empty connection set.

`RocketMQClientProvider.findConsumerConnections` (`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQClientProvider.java:313-334`) counts those per-group answers as scan failures, so an all-offline cluster is indistinguishable from all brokers being unreachable and trips the all-failed guard at line 332. The provider's own convention is that normal "nothing here" states return empty, not 502 (comment at `:175-177`, `isTopicNotExist` handling).

## Impact

Any cluster whose consumers are simply not running shows a hard failure on the Clients page and loses the producer connections fetched in the same request, instead of an empty/partial list.

## Expected behavior

An offline group is a normal "no connections right now" answer: the consumer scan should treat it as a successful empty result (all-offline ⇒ empty list), and the explicit producer-group query should return an empty list. Genuine broker failures keep returning 502, and partial scans keep returning partial results.

## Related work

This refines the all-failed heuristic introduced for #1142/#1143 (distinguish failed scans from empty results); it does not change it for real failures. The same "normal absence → empty" convention was already applied to NO_MESSAGE key queries (#3305) and topic-route absence (#3359).

## PR

#4002

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQClientProvider.java:313-334 and review the convention described at lines 175-177. Compare the client and producer connection endpoints, then inspect PR #4002 and verify that offline groups produce empty or partial results while genuine broker failures still return 502.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.