Skip to content

[BUG] discoveryUpstreamHandlerEvent ignores DELETE events (etcd path) — stale upstreams never removed #6661

Description

@Aias00
  • Severity: High
  • Location:
    shenyu-sync-data-center/shenyu-sync-data-api/src/main/java/org/apache/shenyu/sync/data/core/AbstractPathDataSyncService.java:132-141

Description:
The method body is if (!EventType.DELETE.equals(eventType)) { Optional.ofNullable(updateData).ifPresent(e -> cacheDiscoveryUpstreamData(...)); } — no else branch for DELETE; no unCacheDiscoveryUpstreamData call (or method) exists. The etcd watchChildChange delete callback (EtcdSyncDataService.java:88) correctly fires super.event(..., null, ..., EventType.DELETE) for discovery upstream deletions, and event() dispatches to discoveryUpstreamHandlerEvent, but the handler silently drops it. Every other handler (pluginHandlerEvent, selectorHandlerEvent, ruleHandlerEvent:144-146, appAuthHandlerEvent:153-155, metaDataHandlerEvent:161-167, proxyHandlerEvent:118-123) correctly handles DELETE — only discovery upstream is missing.

Impact:
On etcd sync, when a discovery upstream is deleted, the gateway never removes it from the subscriber cache. Stale upstream endpoints continue to receive traffic.

Suggested fix:
Add a DELETE branch that parses plugin name and selector name from updatePath (same split("/") pattern as proxyHandlerEvent), constructs a DiscoverySyncData, and calls a new unCacheDiscoveryUpstreamData(...) that delegates to discoveryUpstreamDataSubscribers.forEach(e -> e.unSubscribe(...)).

Confidence: High

  • Related existing: none

Identified during the 2026-08-02 deep re-scan; full list in docs/scan2-2026-08-02/00-consolidated-critical-high.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