You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zhouhaopeng (GitHub)" <gi...@apache.org> on 2020/04/03 09:08:24 UTC
[GitHub] [dubbo] zhouhaopeng opened issue #5966: @Reference注解中cluster=“failfast"失效
- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
- [ ] I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.
### Environment
* Dubbo version: master
* Operating System version: mac
* Java version: 1.8
### Steps to reproduce this issue
1. 配置cluster=“failfast”
`@Component("demoHelloWorldComponent")
public class DemoHelloWorldComponent implements HelloWorldService {
@Reference(cluster = "failfast")
private HelloWorldService helloWorldService;
@Override
public String sayHello() {
return helloWorldService.sayHello();
}
}`
2. 在源代码中发现,AbstractDirectory在构造过程中会调用removeParameter(REFER_KEY),导致Cluster$Adaptive在join的时候无法找点key=cluster对的值,返回默认failover策略
` public AbstractDirectory(URL url, RouterChain<T> routerChain) {
if (url == null) {
throw new IllegalArgumentException("url == null");
}
this.url = url.removeParameter(REFER_KEY).removeParameter(MONITOR_KEY);
this.consumerUrl = url.addParameters(StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY)))
.removeParameter(MONITOR_KEY);
setRouterChain(routerChain);
}`
Pls. provide [GitHub address] to reproduce this issue.
### Expected Result
What do you expected from the above steps?
### Actual Result
What actually happens?
If there is an exception, please attach the exception trace:
```
Just put your stack trace here!
```
[ Full content available at: https://github.com/apache/dubbo/issues/5966 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ commented on issue #5966: @Reference注解中cluster=“failfast"失效
Posted by "AlbumenJ (GitHub)" <gi...@apache.org>.
或许可以测试开启debug模式,在具体发生远程调用的方法上 `step into`,就会进入到 `InvokerInvocationHandler` 中,你可以看一下 `invoker` 对象的内容(我上面第一张截图)
[ Full content available at: https://github.com/apache/dubbo/issues/5966 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] zhouhaopeng commented on issue #5966: @Reference注解中cluster=“failfast"失效
Posted by "zhouhaopeng (GitHub)" <gi...@apache.org>.

我的是master分支
[ Full content available at: https://github.com/apache/dubbo/issues/5966 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ commented on issue #5966: @Reference注解中cluster=“failfast"失效
Posted by "AlbumenJ (GitHub)" <gi...@apache.org>.

请问你是否配置了覆盖信息,另外麻烦看一下 consumerUrl 的值,在 dictionary 中
[ Full content available at: https://github.com/apache/dubbo/issues/5966 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] zhouhaopeng commented on issue #5966: @Reference注解中cluster=“failfast"失效
Posted by "zhouhaopeng (GitHub)" <gi...@apache.org>.
refer里面包含了cluster参数
在2020年04月03日 21:54,Albumen Kevin 写道:
这里删除的是refer和monitor参数,并没有看到删除你前面提到的cluster参数哦
另外,我刚刚在自己项目上指定cluster=“failfast"也是正常使用failfast策略的(Dubbo 版本 2.7.5)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
[ Full content available at: https://github.com/apache/dubbo/issues/5966 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] zhouhaopeng commented on issue #5966: @Reference注解中cluster=“failfast"失效
Posted by "zhouhaopeng (GitHub)" <gi...@apache.org>.
源码下 dubbo-demo/dubbo-demo-annotation 工程,consumer是HelloWorldService
Albumen Kevin <no...@github.com> 于2020年4月3日周五 下午11:05写道:
> [image: image]
> <https://user-images.githubusercontent.com/9292748/78375395-56b47a00-75ff-11ea-99d4-833a55d31a92.png>
> 请问你是否配置了覆盖信息,另外麻烦看一下 consumerUrl 的值,在 dictionary 中
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/dubbo/issues/5966#issuecomment-608493753>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AIZUKHVBVI5VW7NGC5J4HH3RKX3KLANCNFSM4L3WHDIQ>
> .
>
[ Full content available at: https://github.com/apache/dubbo/issues/5966 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ commented on issue #5966: @Reference注解中cluster=“failfast"失效
Posted by "AlbumenJ (GitHub)" <gi...@apache.org>.
这里没问题的,从 url 读取 `cluster` 参数,如果为空则返回默认值(第二个参数 defaultValue) `failover`
[ Full content available at: https://github.com/apache/dubbo/issues/5966 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo] zhouhaopeng commented on issue #5966: @Reference注解中cluster=“failfast"失效
Posted by "zhouhaopeng (GitHub)" <gi...@apache.org>.
大哥,帮我看下
hp zh <ha...@gmail.com> 于2020年4月3日周五 下午11:26写道:
> 源码下 dubbo-demo/dubbo-demo-annotation 工程,consumer是HelloWorldService
> Albumen Kevin <no...@github.com> 于2020年4月3日周五 下午11:05写道:
>
>> [image: image]
>> <https://user-images.githubusercontent.com/9292748/78375395-56b47a00-75ff-11ea-99d4-833a55d31a92.png>
>> 请问你是否配置了覆盖信息,另外麻烦看一下 consumerUrl 的值,在 dictionary 中
>>
>> —
>> You are receiving this because you authored the thread.
>> Reply to this email directly, view it on GitHub
>> <https://github.com/apache/dubbo/issues/5966#issuecomment-608493753>, or
>> unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/AIZUKHVBVI5VW7NGC5J4HH3RKX3KLANCNFSM4L3WHDIQ>
>> .
>>
>
[ Full content available at: https://github.com/apache/dubbo/issues/5966 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org