Skip to content

spring cloud gateway 流程bug | SC gateway NPE in GatewayRuleManager #2698

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

Closed
992441831 opened this issue Apr 26, 2022 · 5 comments
Closed
Labels
area/gateway-flow-control Issues or PRs related to API gateway flow control duplicate This issue or pull request already exists

Comments

@992441831
Copy link

No description provided.

@992441831
Copy link
Author

java.lang.NullPointerException: null
at com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayRuleManager$GatewayRulePropertyListener.applyToConvertedParamMap(GatewayRuleManager.java:230) ~[sentinel-api-gateway-adapter-common-1.8.0.jar:na]

springcloudgateway定义了两个路由规则 id: path-route path-route2
启动时先设置好path-route的流控规则(通过方式GatewayRuleManager.loadRules(rules))
然后路由path-route2会一个局部过滤器,局部过滤器会更新path-route的流控规则
此时调用path-route2会出现上面错误,而先先用path-route两次后,再调用path-route2就不报错

@992441831
Copy link
Author

错误原因为 ParameterMetricStorage.getParamMetricForResource(resource) 为null
所以 ParameterMetricStorage.getParamMetricForResource(resource).clearForRule(rule); 会抛空指针异常

@sczyh30
Copy link
Member

sczyh30 commented Apr 27, 2022

This has been fixed in Sentinel 1.8.1 (via #1729)

@sczyh30 sczyh30 added the area/gateway-flow-control Issues or PRs related to API gateway flow control label Apr 27, 2022
@992441831
Copy link
Author

992441831 commented Apr 27, 2022 via email

@sczyh30 sczyh30 added the duplicate This issue or pull request already exists label Apr 27, 2022
@sczyh30 sczyh30 changed the title springcloudgateway流程bug spring cloud gateway 流程bug | SC gateway NPE in GatewayRuleManager Jun 17, 2022
@sczyh30 sczyh30 closed this as completed Jun 17, 2022
@992441831
Copy link
Author

992441831 commented Jun 17, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway-flow-control Issues or PRs related to API gateway flow control duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants