apache / apache/rocketmq

[Bug] Proxy admin topicExist hides non-not-found route lookup errors

Open
#10,801 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

### Before Creating the Bug Report

- [x] I found a bug, not just asking a question, which should be created in GitHub Issues.
- [x] I have searched the existing issues and believe this is not a duplicate.
- [x] I have confirmed that this bug belongs to the current repository.

### Describe the Bug

`DefaultAdminService#topicExist` currently catches every `Throwable` from NameServer route lookup and returns `false`:

```java
try {
topicRouteData = this.getTopicRouteDataDirectlyFromNameServer(topic);
topicExist = topicRouteData != null;
} catch (Throwable e) {
topicExist = false;
}
```

This treats network failures, authorization failures, serialization bugs, and other unexpected errors as "topic does not exist". In admin flows this can hide the real failure and make the caller continue with the wrong diagnosis.

This is inconsistent with `createTopicOnTopicBrokerIfNotExist`, which already uses `TopicRouteHelper.isTopicNotExistError(e)` to distinguish a real not-found response from other failures.

### Expected Behavior

`topicExist` should return `false` only for explicit topic-not-found errors. Other route lookup failures should be surfaced to the caller instead of being silently converted to "not exist".

### Scope

RocketMQ Studio Track 2 / Proxy Admin correctness. This affects Proxy-side admin checks that rely on NameServer route lookup before reporting or creating metadata.

### Proposed Fix

Use `TopicRouteHelper.isTopicNotExistError(e)` in `topicExist`. Return `false` for topic-not-found, and throw an `IllegalStateException` for unexpected failures. Add regression tests for both cases.

Contributor guide

Open the contributing guide

Research direction

Start at DefaultAdminService#topicExist and compare its NameServer route lookup handling with createTopicOnTopicBrokerIfNotExist, especially TopicRouteHelper.isTopicNotExistError(e). Add regression tests covering explicit topic-not-found and unexpected route lookup failures, then run the relevant admin or proxy test suite to verify both outcomes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.