[BUG] discoveryUpstreamHandlerEvent ignores DELETE events (etcd path) — stale upstreams never removed
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- 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`](docs/scan2-2026-08-02/00-consolidated-critical-high.md)._
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.