Skip to content
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

[BUG] Sentinel Plugin use default fallbackUri instead of configured empty one #5560

Open
1 task done
cxshun opened this issue Apr 29, 2024 · 1 comment
Open
1 task done
Labels
type: bug Something isn't working

Comments

@cxshun
Copy link

cxshun commented Apr 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When enable Sentinel plugin in dashboard, with rule fallback uri setting to null, I found that bootstrap using default fallback/sentinel instead of my configured value null.
image
image

After search the source, I found that SentinelHandle has default value, as show below.

private String fallbackUri = "/fallback/sentinel";

When I update sentinel rule config with fallbackuri is empty, I found dashboard update request is without the fallbackuri, as showed below.

PUT /rule/1784868213710041088 HTTP/1.1
{
    "selectorId": "1784868086001872896",
    "name": "默认限流",
    "matchMode": "0",
    "handle": "{\"degradeRuleCount\":\"0\",\"degradeRuleEnable\":\"1\",\"degradeRuleGrade\":\"0\",\"degradeRuleMinRequestAmount\":5,\"degradeRuleStatIntervals\":1,\"degradeRuleSlowRatioThreshold\":0.5,\"degradeRuleTimeWindow\":0,\"flowRuleControlBehavior\":\"0\",\"flowRuleCount\":\"10\",\"flowRuleMaxQueueingTimeMs\":\"500\",\"flowRuleWarmUpPeriodSec\":10,\"flowRuleEnable\":1,\"flowRuleGrade\":\"0\"}",
    "loged": true,
    "enabled": true,
    "matchRestful": false,
    "sort": 1,
    "ruleConditions": [
        {
            "id": "1784868214053974016",
            "ruleId": "1784868213710041088",
            "paramType": "uri",
            "paramTypeName": "uri",
            "operator": "pathPattern",
            "operatorName": "pathPattern",
            "paramName": "/",
            "paramValue": "/**",
            "dateCreated": "2024-04-29 20:51:29",
            "dateUpdated": "2024-04-29 20:51:29"
        }
    ],
    "id": "1784868213710041088"
}

Then with the websocket data from admin to bootstrap, it shows the fallbackUri is missing.

2024-04-29 18:22:30 [WebSocketConnectReadThread-29] INFO  org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient - handleResult({"groupType":"RULE","eventType":"UPDATE","data":[{"id":"1784868213710041088","name":"默认限流","pluginName":"sentinel","selectorId":"1784868086001872896","matchMode":0,"sort":1,"enabled":true,"loged":true,"handle":"{\"degradeRuleCount\":\"0\",\"degradeRuleEnable\":\"1\",\"degradeRuleGrade\":\"0\",\"degradeRuleMinRequestAmount\":5,\"degradeRuleStatIntervals\":1,\"degradeRuleSlowRatioThreshold\":0.5,\"degradeRuleTimeWindow\":0,\"flowRuleControlBehavior\":\"0\",\"flowRuleCount\":\"10\",\"flowRuleMaxQueueingTimeMs\":\"500\",\"flowRuleWarmUpPeriodSec\":10,\"flowRuleEnable\":1,\"flowRuleGrade\":\"0\"}","conditionDataList":[{"paramType":"uri","operator":"pathPattern","paramName":"/","paramValue":"/**"}],"beforeConditionDataList":[],"matchRestful":false}]})

When I tried to trigger the sentinel plugin, it has the following log:

2024-04-29 17:00:31 [shenyu-netty-epoll-9] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide rule success match , rule name :xp-device-boot
2024-04-29 17:00:31 [shenyu-netty-epoll-2] ERROR org.apache.shenyu.plugin.api.utils.WebFluxResultUtils - can not match selector data: divide , path is /fallback/sentinel
2024-04-29 17:00:31 [shenyu-netty-epoll-5] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - sentinel rule success match , rule name :默认限流
2024-04-29 17:00:31 [shenyu-netty-epoll-5] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide selector match success from default strategy
2024-04-29 17:00:31 [shenyu-netty-epoll-5] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide selector success match , selector name :xp-device-boot
2024-04-29 17:00:31 [shenyu-netty-epoll-5] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide rule success match , rule name :xp-device-boot
2024-04-29 17:00:31 [shenyu-netty-epoll-3] ERROR org.apache.shenyu.plugin.api.utils.WebFluxResultUtils - can not match selector data: divide , path is /fallback/sentinel

Expected Behavior

When configure Sentinel Plugin's fallback uri to null, it should be null.

Steps To Reproduce

  1. Add sentinel plugin selector match request uri.
  2. Add sentinel plugin selector rule to configure strategy, configure fallback uri to null or leave it empty.
  3. Start to benchmark ot trigger sentinel plugin.

Environment

ShenYu version(s):2.6.1

Debug logs

2024-04-29 17:00:31 [shenyu-netty-epoll-9] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide rule success match , rule name :xp-device-boot
2024-04-29 17:00:31 [shenyu-netty-epoll-2] ERROR org.apache.shenyu.plugin.api.utils.WebFluxResultUtils - can not match selector data: divide , path is /fallback/sentinel
2024-04-29 17:00:31 [shenyu-netty-epoll-5] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - sentinel rule success match , rule name :默认限流
2024-04-29 17:00:31 [shenyu-netty-epoll-5] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide selector match success from default strategy
2024-04-29 17:00:31 [shenyu-netty-epoll-5] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide selector success match , selector name :xp-device-boot
2024-04-29 17:00:31 [shenyu-netty-epoll-5] INFO  org.apache.shenyu.plugin.base.AbstractShenyuPlugin - divide rule success match , rule name :xp-device-boot
2024-04-29 17:00:31 [shenyu-netty-epoll-3] ERROR org.apache.shenyu.plugin.api.utils.WebFluxResultUtils - can not match selector data: divide , path is /fallback/sentinel

Anything else?

No response

@cxshun cxshun added the type: bug Something isn't working label Apr 29, 2024
@cxshun cxshun changed the title [BUG] Sentinel Plugin use default /fallback/sentinel instead of configure empty one [BUG] Sentinel Plugin use default fallbackUri instead of configured empty one Apr 29, 2024
@moremind
Copy link
Member

moremind commented May 8, 2024

this has fixed in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants