alibaba / alibaba/Sentinel

[Dashboard Bug] oncurrent operator(add rule) multi application's same type rule will lose at least one application's rules

Open
#1,820 2 comments 0 reactions 0 assignees View on GitHub
area/dashboard
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## Issue Description

Type: *bug report*

### Describe what happened (or what feature you want)
when someone A operator one application's flowrule, just wanna add one, at the same time, aonther person B just review the page about the flowrule by another application, after B reivewed, A just submit the form data, then refresh the page just find flowrules just have onlyone rule that he just added , the other rules just gone.

### Describe what you expected to happen
after add one rules, A will see all flowrules in the page

### How to reproduce it (as minimally and precisely as possible)

1. open A application's flowrule page such as http://sentinel.xxx.com/#/dashboard/v2/flow/A
2. add one flow rule
3. open aothner browser tabpage such as http://sentinel.xxx.com/#/dashboard/v2/flow/B
4. do not refresh the page in step 1, and just add aother flowrule in the same page open by the step 1.
5. when finish you will only see the flow rule add by step 4 and the rule add by step 1 was gone

### Tell us your environment
sentinel dashboard 1.7.2
datasource zookeeper

### Anything else we need to know?

maybe the reason is in the codes : InMemoryRuleRepositoryAdapter

```java
@Override
public List saveAll(List rules) {
// TODO: check here.
allRules.clear();
machineRules.clear();
appRules.clear();

if (rules == null) {
return null;
}
List savedRules = new ArrayList<>(rules.size());
for (T rule : rules) {
savedRules.add(save(rule));
}
return savedRules;
}

```
the clear() method not only clear current application's rule,but also all application's rules

Contributor guide

Open the contributing guide

Research direction

Start by inspecting InMemoryRuleRepositoryAdapter.saveAll and reproduce the two-application flow-rule sequence described in the issue using the Sentinel dashboard with the Zookeeper datasource. Done means adding a rule for one application no longer removes the other application's existing rules, with the dashboard showing all retained rules after submission and refresh.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.