coderzSSS opened a new issue #8741:
URL: https://github.com/apache/dubbo/issues/8741
### Environment
* Dubbo version: 3.0.2.1
* Operating System version: Linux 4.14.152-127.182.amzn2.x86_64
* Java version: 1.8_310
### Steps to reproduce this issue
1. A provider annotated with @DubboService(tag = 'XXX')
2. A Consumer annotated with @DubboReference(tag = 'XXX')
3. Consumer will complain no provider found
Possible Cause:
1. TagDynamicStateRouter#line 112 will hardcode tag as 'noTag' even the
service has a valid tag but without tagRouterRule set
```
invocation.setAttachment(TAG_KEY, NO_TAG);
```
2. TagStaticStateRouter#64 try to locate the tag with below code, however
the tag attachment already set as noTag from previous router, hence the tag is
always noTag even the url has a valid tag set.
```
String tag = StringUtils.isEmpty(invocation.getAttachment(TAG_KEY)) ?
url.getParameter(TAG_KEY) :
invocation.getAttachment(TAG_KEY);
if (StringUtils.isEmpty(tag)) {
tag = NO_TAG;
}
```
Possible Fix:
replace StringUtils.isEmpty as below function:
```
boolean isNoTag(String value) {
return StringUtils.isEmpty(value) || NO_TAG.equals(value));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]