Skip to content

[BUG] DiscoveryUpstreamDataHandler.doRefresh() (WebSocket) does not call refresh() before re-adding data #6782

Description

@Aias00
  • Severity: Medium
  • Location:
    shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/handler/DiscoveryUpstreamDataHandler.java:40-42

Description:
doRefresh directly calls data.forEach(... onSubscribe) without first calling refresh() on subscribers. AuthDataHandler.doRefresh() (line 43: authDataSubscribers.forEach(AuthDataSubscriber::refresh)) and ProxySelectorDataHandler.doRefresh() (line 45) both clear stale data first then re-add. DiscoveryUpstreamDataHandler is the only handler that skips the clear step.

Impact:
On a WebSocket REFRESH event for discovery upstreams, stale upstream data is not cleared before new data is added; old discovery entries no longer present in the refresh payload persist.

Suggested fix:
Add discoveryUpstreamDataSubscribers.forEach(DiscoveryUpstreamDataSubscriber::refresh) as the first line of doRefresh, matching AuthDataHandler and ProxySelectorDataHandler.

Confidence: High


Identified during the 2026-08-02 deep re-scan; full list in docs/scan2-2026-08-02/06-medium-tiers.md.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions