apache / apache/rocketmq-dashboard

[Studio][Bug] Queue browser view button spins forever after reloading the queue list mid-pull

Open
#4,279 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 / Evidence

`useQueueBrowser`(`web/src/components/QueueBrowser.tsx`)的拉取状态与请求代数在"重新加载队列"时失步:

- `loadQueues` 通过 `const requestId = ++requestSeqRef.current` 递增代数,并清空 `queues/offsets/entries`,但**不清空 `pulling` 状态**(对比 `[instanceId, topic]` 重置 effect 会同时 `pullingRef.current.clear(); setPulling(new Set())`)。
- `handlePull` 的 `finally` 块总是从 `pullingRef` 删除 key,但仅当 `requestId === requestSeqRef.current` 时才同步 React 状态:`if (requestId === requestSeqRef.current) setPulling(new Set(pullingRef.current))`。

因此当一次拉取在途时再次点击"加载队列"(拉取期间按钮不禁用,`loading` 只由 loadQueues 维护),队列行 `查看` 按钮的 `loading={state.pulling.has(key)}` 永久为 true,而 ref 中已无该 key——没有任何请求在途,按钮却永久转圈。恢复只能再次点击"查看"(这会静默发起一次新的后端拉取)或切换 topic/实例。

回归测试(先红):`clears the pulling indicator when the queue list reloads mid-pull` 在未修复代码上失败,修复后通过。

## Impact

消息页"按队列浏览"模式的核心操作陷入永久 spinner;运维人员会误以为 broker 读取卡死。恢复动作(再点一次查看)会隐式重复触发后端拉取。

## Expected behavior

重新加载队列列表应使所有在途拉取失效并同步清空拉取指示器,与 topic/实例切换时的既有重置行为一致。

## Related work

- 同文件 `[instanceId, topic]` 切换 effect 已有完整的 `pullingRef` + `setPulling` 重置(本缺陷是该模式在 reload 路径上的缺失)。
- 仓库内其余请求守卫(如 cluster 页 brokerConfigDiffRequestRef 等)均为同代数模式。
- #2900(closed)「Queue Browser allows duplicate queue loads and same-queue pulls」修复的是**重复拉取抑制**(其守卫 `pullingRef.has(key)`/`loadingRef` 已在现行代码中);本缺陷是另一面:重载路径的**代数失步**使拉取指示器永久滞留,该守卫不覆盖。

## PR

Fix: #4283.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in web/src/components/QueueBrowser.tsx and read the useQueueBrowser loadQueues path alongside the existing instance/topic reset effect. Run the regression test named “clears the pulling indicator when the queue list reloads mid-pull”; done means the test passes and reloading during an in-flight pull clears the queue-row loading indicators.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.