Skip to content

[BUG] dashbord高并发下更新规则,可能会导致数据错乱 #3297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Navicoder opened this issue Dec 29, 2023 · 0 comments
Open

Comments

@Navicoder
Copy link

Navicoder commented Dec 29, 2023

在sentinel dashbord【版本1.8.0】更新规则,会推送给 客户端 sentinel-transport ,在sentinel-transport 更新至内存时 发现高并发下更新会有安全问题(虽然,一般这不会出现高并发)

public class FlowRuleManager {
         private static final class FlowPropertyListener implements PropertyListener<List<FlowRule>> {
            @Override
            public void configUpdate(List<FlowRule> value) {
                Map<String, List<FlowRule>> rules = FlowRuleUtil.buildFlowRuleMap(value);
                if (rules != null) {
                   // 1 
                    flowRules.clear();
                    // 2
                    flowRules.putAll(rules);
                }

1 和 2这两步不是原子的,高并发调用下,可能会出现数据错乱问题

@Navicoder Navicoder changed the title [BUG] [BUG] dashbord高并发下更新规则,可能会导致数据错乱 Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant