Skip to content

[BUG] The rule cache can not be deleted in shenyu-bootstrap when use nacos as sync center. #5928

@Wweiei

Description

@Wweiei

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When use nacos as sync center. When a rule is deleted, the corresponding cache in Bootstrap is not synchronously removed, leading to the path still being callable.
1、add an selector and rule

Image
2、call the interface, can obtain the correct response

Image

3、delete the rule. the rule list is empty, as below picture.

Image

4、call the interface again, can still obtain the correct response instead of "divide:Rule not found!".

Image

Expected Behavior

After deleting the rule, re-requesting the interface will result in “{"code":-102,"message":"divide:Rule not found!"}”

Steps To Reproduce

  1. check out to master branch and pull the lastest code.
  2. use nacos as data sync center.
  3. add one rule in a selector.
  4. delete the rule.

Environment

ShenYu version(s):branch master latest, tag v2.7.0

Debug logs

No response

Anything else?

When a rule is deleted, the bootstrap will observe the dynamic configuration key deleted by Nacos, and then parse out the selectorId and ruleId from the key, and finally remove the corresponding ruleId from the RULE_MAP cache. During the parsing of the Nacos key, the selectorId and ruleId were set to incorrect values.

Image

As result the corresponding rule cache for the selectorId and ruleId could not be found when removeRuleData in RULE_MAP.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions