Aias00 opened a new issue, #7753: URL: https://github.com/apache/shenyu/issues/7753
### Current behavior Namespace-scoped refresh events can contain an empty group list while carrying the namespace explicitly. The cluster forwarder serializes only group, event type and source; the master controller republishes the event using the constructor that assigns `namespaceId=null`. For an empty refresh there is no record from which to infer the namespace. `WebsocketDataChangedListener.sendEmptySnapshot()` rejects a blank namespace, so the master sends no empty refresh to gateways even though the originating event contains the required namespace. ### Locations / actual trigger - [SyncDataServiceImpl.java:145–157](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/SyncDataServiceImpl.java#L145) emits explicit namespace events even for empty PLUGIN/SELECTOR/RULE lists. - [ClusterDataChangedEventForwarder.java:98–100](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/ClusterDataChangedEventForwarder.java#L98) creates the namespace-less payload. - [ClusterDataChangedEventController.java:116](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ClusterDataChangedEventController.java#L116) republishes with the three-argument constructor. - [WebsocketDataChangedListener.java:108–126](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/websocket/WebsocketDataChangedListener.java#L108) routes empty refreshes only for a supplied namespace. In cluster mode, invoke the existing `POST /namespace-plugin/syncPluginAll` API on a non-master node for a namespace whose relevant group is empty. Forwarding can return success while the empty snapshot is suppressed on the master. ### Reproduction / validation A Java probe compiled the current event, payload, forwarder, receiving controller, listener and listener interface. An in-process RestTemplate stub serialized/deserialized the actual forwarded payload and passed it to the actual receiving controller; WebsocketCollector's final send boundary was mocked to count frames: ```text ORIGINAL namespace=namespace-a FORWARDED=true PAYLOAD={"groupKey":"RULE","eventType":"REFRESH","source":"[]"} RECEIVED namespace=null size=0 DIRECT_EMPTY_SENDS=1 FORWARDED_EMPTY_ADDITIONAL_SENDS=0 ``` The direct namespace-aware listener call is the passing control. A separate reviewer traced the real namespace-sync producer and corrected the sink to WebSocket. This is an in-process forwarding/listener reproduction, not a real cluster/WebSocket deployment. It does **not** claim a null-key exception in the HTTP listener. ### Impact / suggested fix Full namespace refresh through a non-master cannot reconcile gateways to an empty group, so previously stale configuration can remain. Include the explicit namespace in the forwarded payload and use the namespace-aware constructor on the receiver. Define compatibility for older payloads that have no namespace; avoid guessing namespace from the first record for empty lists. ### Related existing work #7457 covers node/path configuration-center listeners ignoring empty refreshes and explicitly excludes WebSocket. #6731 concerns gateway self-refresh cache behavior. This report loses the namespace in the admin cluster wire payload before the existing WebSocket empty-snapshot implementation can run. Targeted cluster/namespace/refresh searches found no matching issue. ### Reviewed revision Apache ShenYu 2.7.2-SNAPSHOT, `master@66d7d954ca37d651a5ad916f988a8081157a7ab4`. P2 / Medium, high confidence. Unit-test and CI issue categories excluded. -- 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]
