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/21 17:59:42 UTC

[I] [Studio][Bug] Resource counts and the delete guard resolve the numeric instance id through the name-first lookup, so an instance named like another id reads the wrong instance [rocketmq-dashboard]

unbridled-41 opened a new issue, #4789:
URL: https://github.com/apache/rocketmq-dashboard/issues/4789

   ### Studio Version
   
   Trunk `rocketmq-studio` @ `4c697f07` (line references are as of that commit).
   
   ### Problem
   
   `InstanceService` holds an already-resolved instance but hands its **numeric id as a string** to the vendor provider for resource counts:
   
   - `loadCounts` (`server/src/main/java/org/apache/rocketmq/studio/instance/InstanceService.java:180-186`, used by the instance list via `fillCountsInParallel`): `provider.countTopics(String.valueOf(instance.getId()))`.
   - the delete guard (`InstanceService.java:654-658`): `provider.countTopics(String.valueOf(id))` decides whether an instance may be deleted.
   
   Every provider resolves that string through `InstanceRepository.findByIdentifier` (`InstanceRepository.java:42-57`), which tries the unique **name first** and only falls back to the numeric id. Instance names are free-form (up to 64 chars, digits allowed — `requireInstanceName` only trims and length-checks), so an instance literally named `42` shadows the instance whose primary key is `42`:
   
   1. The instance list row for the numeric instance shows the named instance's topic/group counts (or a misleading 400 "missing cloud binding" when the named instance is Apache and the counted one is cloud).
   2. Worse, the destructive path: `POST` delete of the numeric instance evaluates its managed-resource guard against the **named** instance. An operator can delete an instance whose topics/groups still exist, orphaning them; and the opposite direction blocks a legitimately empty instance.
   
   ### Evidence
   
   1. `findByIdentifier` → `findByName(identifier)` before `findById(Long.parseLong(...))` with no rejection of pure-digit names (`InstanceRepository.java:46-51`).
   2. `requireInstanceName` (`InstanceService.java:554-562`) imposes no charset constraint, and `createApacheInstance` only requires name + endpoint, so a numeric name is storable through the public API today.
   3. The codebase's own javadoc on `findByIdentifier` says the name is primary and the id a fallback — callers that already hold the resolved instance must not round-trip through that ambiguous resolution.
   4. `ApacheInstanceProvider.countTopics` (`provider/apache/ApacheInstanceProvider.java:76-81`) maps through `findByIdentifier(...).getName()` then counts by that name — so the string is resolved by name first, confirming the shadowing.
   
   ### Impact
   
   - Wrong resource counts on the instance list for any deployment where an instance name equals another instance's numeric id (self-inflicted but storable via the API, and ids are small sequential integers so collisions are realistic).
   - The delete guard can read the wrong instance's counts: deletion of a non-empty instance succeeds (orphans its topics/groups), or a clean instance is blocked by another instance's counts.
   
   ### Expected behavior
   
   Callers that already hold the resolved `InstanceVO` pass its canonical name (`getName()`) to the provider; name-first resolution of the canonical name always returns the instance itself, immune to shadowing.
   
   ### Related work
   
   - #2050 (closed): established "instance name is the immutable external identifier" — this defect is the callers that bypass it by passing the id string.
   - #4716 (closed): legacy null-vendor reading, same package, unrelated to identifier resolution.
   - #4006 (open): offline-client 502 — different resolution surface (`RocketMQClientProvider`), unaffected by this change.
   
   ## PR
   
   Fix: #… (opened together with this issue).


-- 
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.apache.org

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


Re: [I] [Studio][Bug] Resource counts and the delete guard resolve the numeric instance id through the name-first lookup, so an instance named like another id reads the wrong instance [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #4789: [Studio][Bug] Resource counts and the delete guard resolve the numeric instance id through the name-first lookup, so an instance named like another id reads the wrong instance
URL: https://github.com/apache/rocketmq-dashboard/issues/4789


-- 
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: [I] [Studio][Bug] Resource counts and the delete guard resolve the numeric instance id through the name-first lookup, so an instance named like another id reads the wrong instance [rocketmq-dashboard]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #4789:
URL: https://github.com/apache/rocketmq-dashboard/issues/4789#issuecomment-5765164913

   ## Evaluation
   
   **Classification:** Bug — instance identity resolution ambiguity
   **Severity:** MEDIUM-HIGH
   **Status:** ✅ Confirmed
   
   ### Verification
   
   Code references verified against `rocketmq-studio @ 4c697f07`:
   
   - `InstanceRepository.findByIdentifier` (line 42-57): `findByName(identifier)` is tried before `findById(Long.parseLong(...))` — a numeric instance name shadows the numeric ID.
   - `InstanceService.loadCounts` (line 180-186): passes `String.valueOf(instance.getId())` to provider, which re-resolves through the ambiguous path.
   - `requireInstanceName` (line 554-562): no charset constraint — pure-digit names are accepted.
   - `ApacheInstanceProvider.countTopics` (line 76-81): maps through `findByIdentifier`, confirming the shadowing.
   
   ### Impact
   
   - Wrong resource counts on instance list when a name matches another instance's numeric ID.
   - Delete guard evaluates against the wrong instance — can orphan topics/groups or block legitimate deletion.
   
   ### Associated PR
   
   PR #4790 (by @unbridled-41) — fix: resolve resource counts by canonical instance name.
   
   ---
   *Evaluated by github-manager bot*


-- 
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: [I] [Studio][Bug] Resource counts and the delete guard resolve the numeric instance id through the name-first lookup, so an instance named like another id reads the wrong instance [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #4789:
URL: https://github.com/apache/rocketmq-dashboard/issues/4789#issuecomment-5881198324

   This issue has been automatically closed because there has been no activity for 7 days. If you believe this issue is still relevant, please reopen it with updated information.


-- 
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