Aias00 opened a new issue, #7438:
URL: https://github.com/apache/shenyu/issues/7438
## Is there an existing issue for this?
- [x] I searched existing open and closed issues.
## Current Behavior
Dubbo gray routing supports upstream group/version fields, but the shared
upstream health/cache identity ignores them. Two gray upstream entries with the
same protocol/address and different group/version can collapse into one cached
upstream.
The Dubbo selector handler copies group/version into `Upstream` and submits
the list to `UpstreamCacheManager`. `Upstream.equals()/hashCode()` and the
manager's map key use only URL/protocol. `UpstreamCheckTask.putToMap()`
suppresses an entry when `list.contains(upstream)` is true, so one logical
variant disappears. Gray load balancing reads this cached list and then filters
invokers by the selected entry's group/version.
## Expected Behavior
Distinct group/version targets should remain selectable even when they share
a physical endpoint. Sharing endpoint health information must not merge logical
routing variants or their configured weights.
## Steps To Reproduce
Disable global upstream checks for a deterministic local reproduction, then
submit:
```java
Upstream first =
Upstream.builder().protocol("dubbo://").url("127.0.0.1:20880")
.group("blue").version("v1").weight(10).status(true).healthCheckEnabled(false).build();
Upstream second =
Upstream.builder().protocol("dubbo://").url("127.0.0.1:20880")
.group("green").version("v2").weight(20).status(true).healthCheckEnabled(false).build();
UpstreamCacheManager manager = UpstreamCacheManager.getInstance();
manager.submit("gray-identity-repro", List.of(first, second));
System.out.println(first.equals(second)); // true
System.out.println(manager.findUpstreamListBySelectorId("gray-identity-repro").size());
// 1
```
Observed against current compiled production classes: two submitted entries,
one retained (`blue/v1`).
## Environment
ShenYu `2.7.2-SNAPSHOT`, `master` at
`67596c1d228b62da75cd0a0ecb47d0ac5d995384`, Dubbo gray selector with
same-address logical variants.
## Location And Impact
-
[Upstream.java:498](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-loadbalancer/src/main/java/org/apache/shenyu/loadbalancer/entity/Upstream.java#L498):
equality ignores group/version.
-
[UpstreamCacheManager.java:252](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-loadbalancer/src/main/java/org/apache/shenyu/loadbalancer/cache/UpstreamCacheManager.java#L252):
key ignores group/version.
-
[UpstreamCheckTask.java:288](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-loadbalancer/src/main/java/org/apache/shenyu/loadbalancer/cache/UpstreamCheckTask.java#L288):
list insertion suppresses equal entries.
-
[ApacheDubboGrayLoadBalance.java:57](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/proxy/ApacheDubboGrayLoadBalance.java#L57):
gray routing consumes the collapsed list.
Severity: Medium. Confidence: high. One group/version becomes unavailable to
gray selection, and weight/offline changes can affect the wrong same-address
variant. This finding concerns the shared-cache gray load-balancing path, not
every direct selector-handle reference-building path.
## Suggested Fix And Regression Coverage
Separate logical upstream routing identity from physical endpoint health
identity, or use a Dubbo-specific key that includes group/version while
preserving existing HTTP behavior. Verify insertion, weight changes, offline
updates and removal of same-address variants independently.
## Validation And Related Issues
- Direct local production-cache reproduction retained only one of two
group/version variants.
- An independent verifier traced operator configuration through the Dubbo
handler and gray invoker filtering.
- Existing `UpstreamTest,UpstreamCacheManagerTest`: 13 tests passed. Related
Dubbo cache/handler/gray tests: 23 tests passed. They do not cover same-address
group/version variants.
- #5802 concerns an older gray load-balancing NPE. #6798 concerns
reference-cache invalidation. Neither covers logical upstream identity
collapsing in the health/cache layer.
- No live Dubbo provider/registry integration deployment was run.
--
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]