You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/09/06 16:55:48 UTC

[PR] fix(client): treat offline group connections as empty results [rocketmq-dashboard]

unbridled-41 opened a new pull request, #4002:
URL: https://github.com/apache/rocketmq-dashboard/pull/4002

   Fixes #TBD-ISSUE.
   
   ## Problem / Evidence
   
   `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 completely normal state (consumer applications stopped, dev/test cluster, nightly window) — instead of returning an empty connection list. Because the consumer scan runs after the producer scan in the same request, the producer connections already collected are discarded too.
   
   The same misclassification hits the explicit producer-group lookup: `GET /api/producer/connection?...&producerGroup=G` returns 502 "Failed to query producer connections: Not found the producer group connection" when group `G` has no online producers.
   
   Client bytecode (rocketmq-tools 5.5.0, the version pinned by `server/pom.xml`), verified via `javap -c` on `DefaultMQAdminExtImpl`:
   
   - `examineConsumerConnectionInfo(String)`: when `ConsumerConnection.getConnectionSet().isEmpty()` it throws `new MQClientException(206, "Not found the consumer group connection")` (bytecode offsets 90–126).
   - `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 exceptions as scan failures, so "all groups offline" is indistinguishable from "all brokers broken" and trips the guard at line 332. The provider's own convention says normal "nothing here" states must be empty, not 502 (existing comment at `:175-177` and the `isTopicNotExist` handling).
   
   ## Root cause / Fix
   
   The all-failed heuristic (attempted > 0 && successful == 0 → 502) treats the offline-group business answers as infrastructure failures. Fix:
   
   - In the consumer scan, an `MQClientException` with response code 206 or message "Not found the consumer group connection" counts as a *successful* per-group query that found nothing, so an all-offline cluster yields an empty list; groups with real failures keep the partial-results behavior, and a scan where every group genuinely fails still returns 502.
   - In the explicit producer-group query, the same offline-group message returns an empty list alongside the existing missing-topic handling.
   
   ## Priority & scoring
   
   PRIORITY 76 = impact 30 (the core Clients page errors out on a routine cluster state and drops already-fetched producer data) + blast radius 14 (every Apache-instance deployment; offline groups are routine) + reproducibility 18 (deterministic, one request, client behavior pinned by bytecode) + maintenance value 14 (extends the established "normal absence → empty" convention already accepted in this repo, e.g. NO_MESSAGE key queries and topic-route absence).
   
   FIX_CONFIDENCE 95 (client exception contract verified against the exact dependency version's bytecode; fix is a per-exception reclassification).
   
   ## Tests
   
   `mvn -B -ntp test -Dtest='RocketMQClientProviderTest'`:
   
   - Before the fix, the new regressions failed with the production errors: `consumerScanTreatsOfflineGroupsAsEmptyInsteadOf502` → `BusinessException: Failed to query consumer connections from all groups`; `producerQueryWithExplicitOfflineGroupReturnsEmptyInsteadOf502` → `BusinessException: Failed to query producer connections: Not found the producer group connection`.
   - After the fix: **Tests run: 27, Failures: 0, Errors: 0** (24 pre-existing + 3 new; `consumerScanFailsWhenEveryGroupConnectionQueryFails` still asserts genuine failures → 502).
   - Full backend suite (`mvn -B -ntp test`): **Tests run: 2038, Failures: 3** — the 3 failures are the pristine-baseline set (AuthCorsIntegrationTest ×2, AliyunInstanceProviderTest ×1, identical messages), i.e. zero new failures; 2035 baseline + 3 new tests.
   
   ## Risk
   
   Low. Only the two specific offline-group answers are reclassified; broker-unreachable failures, partial scans and the system-group short-circuit keep their existing behavior. No API shape change — the response for this normal state changes from an error to an empty list, matching the page's contract.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(client): treat offline group connections as empty results [rocketmq-dashboard]

Posted by "unbridled-41 (via GitHub)" <gi...@apache.org>.
unbridled-41 commented on PR #4002:
URL: https://github.com/apache/rocketmq-dashboard/pull/4002#issuecomment-5560942495

   ## Verification evidence
   
   **CI**: upstream `apache/rocketmq-dashboard` CI cannot run in this environment. Head commit `cd33f79d257bea997e0d51e8f42e1cd6acc6251c`: `commits/{sha}/check-runs` → `total_count: 0`, `commits/{sha}/status` → 0 statuses; the single workflow run recorded for this head SHA ("CI", pull_request) ended `startup_failure` (workflow never started). Recent `rocketmq-studio` base-branch runs show the same `startup_failure`, i.e. pre-existing and unrelated to this change.
   
   **Red light (before the fix)** — `mvn -B -ntp test -Dtest='RocketMQClientProviderTest'`:
   
   ```
   RocketMQClientProviderTest.consumerScanTreatsOfflineGroupsAsEmptyInsteadOf502:515
     » Business Failed to query consumer connections from all groups
   RocketMQClientProviderTest.producerQueryWithExplicitOfflineGroupReturnsEmptyInsteadOf502:548
     » Business Failed to query producer connections: Not found the producer group connection
   Tests run: 27, Failures: 0, Errors: 2
   ```
   
   (The third new test, `consumerScanReturnsOfflineGroupResultsWhenAnotherGroupFails`, passes before and after — it locks in that an offline group does not poison a mixed scan.)
   
   **Green light / module tests (after the fix)**: `Tests run: 27, Failures: 0, Errors: 0` (24 pre-existing + 3 new; the pre-existing `consumerScanFailsWhenEveryGroupConnectionQueryFails` still asserts genuine failures → 502).
   
   **Full suite + baseline**: `mvn -B -ntp test` → `Tests run: 2038, Failures: 3`. The 3 failures are the pristine-baseline set (AuthCorsIntegrationTest.shouldRejectNonAdminMutationBeforeControllerExecution, AuthCorsIntegrationTest.shouldStillRejectAnonymousProtectedRequests, AliyunInstanceProviderTest.getGroupProgressShouldMapLagRowsTest — identical messages to the recorded pristine baseline of 2035 tests / same 3 failures). Zero new failures; 2035 baseline + 3 new tests = 2038.
   
   **Build**: compile clean; the full-suite `BUILD FAILURE` is solely the pre-existing baseline test failures listed above; `mvn -B -ntp clean package` compilation is covered by the suite run and the backend-build job's compile step (no compilation warnings introduced).
   
   **Diff self-check**: 2 files, +66/−3 — `RocketMQClientProvider.java` (+26/−3: per-group offline classification + `isGroupConnectionAbsent` helper) and `RocketMQClientProviderTest.java` (+43: 3 regression tests). No unrelated changes.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(client): treat offline group connections as empty results [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #4002:
URL: https://github.com/apache/rocketmq-dashboard/pull/4002


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org