[BUG] isFull clients bypass discovery-mode URI gating, causing dual upstream registration
Is there an existing issue for this?
- [x] I have searched the existing issues
Current Behavior
When shenyu.discovery.type is set to a registry discovery mode (e.g. nacos), clients are expected to skip local URI registration because upstream instances are sourced from the registry watcher.
Non-isFull clients behave correctly: AbstractContextRefreshedEventListener#onApplicationEvent checks the discovery mode before publishing URI events.
However, isFull=true clients publish meta and URI inside getBeans() and return an empty bean map, so onApplicationEvent returns early at MapUtils.isEmpty(beans) and the discovery-mode gate is never reached.
As a result, in registry discovery mode the admin receives both the local URI registration and the registry-sourced discovery upstreams for the same selector, causing dual upstream registration: local selector-handle rows and registry-watcher discovery rows coexist with diverging weights and duplicate upstream representations.
Expected Behavior
In a registry discovery mode (e.g. nacos), isFull clients should skip local URI registration and let the admin-side registry watcher be the single source of upstreams. Meta registration should still happen so that selectors and rules are created automatically.
Steps To Reproduce
- Start shenyu-admin and shenyu-bootstrap (2.7.x).
- Configure a springmvc client with
isFull=trueandshenyu.discovery.type=nacos(plusshenyu.discovery.serverList,shenyu.discovery.register=true). - Start the client service and watch the admin logs /
/shenyu-client/register-uricalls. - Observe the divide selector: both the URI registration (selector handle / discovery rows written through
doRegisterURI) and the nacos watcher rows exist for the same selector.
Environment
ShenYu version(s):
Debug logs
No response
Anything else?
Root cause: the URI publish of the isFull branch happens before the empty-map early return, so the shenyu.discovery.type check in onApplicationEvent is unreachable for isFull clients (same for SpringWebSocketClientEventListener).
A minimal fix extracts an isDiscoveryLocalMode(context) helper in AbstractContextRefreshedEventListener and gates the URI publish in both isFull branches (meta registration untouched). A PR referencing this issue will follow.
Environment: ShenYu version(s) 2.7.2 / master (2.7.3-SNAPSHOT), Java 17+, MySQL.