[BUG] Zookeeper callback early-returns on all NODE_DELETED events — every config deletion is silently dropped
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- Severity: Critical
- Location:
`shenyu-sync-data-center/shenyu-sync-data-zookeeper/src/main/java/org/apache/shenyu/sync/data/zookeeper/ZookeeperSyncDataService.java:86` (guard), `:102-112` (dead `NODE_DELETED` switch branch)
-
Description:
The `CuratorCacheListener` lambda (`(type, oldData, data)`) has an early guard `if (Objects.isNull(data) || Objects.isNull(data.getData())) { return; }`. Per the Curator 5.7.0 `CuratorCacheListener` contract (verified: the lambda maps to `event(Type, ChildData oldData, ChildData data)` where `data` is "the new data or null"), for `NODE_DELETED` the `data` parameter is `null` because the node no longer exists. Every delete event hits the early return and never reaches the `switch(type)` block. The `case NODE_DELETED: eventType = EventType.DELETE;` branch is dead code. No plugin/selector/rule/auth/metadata/proxy-selector deletion is ever processed on the ZK sync path.
-
Impact:
When any config item is deleted in admin (ZK sync backend), the gateway never removes it from its local cache. Deleted plugins, selectors, rules, app-auths, metadata, proxy-selectors remain active indefinitely — stale routing, phantom rules, security exposure (deleted auth keys still honored).
-
Suggested fix:
Before the null-data guard, check `type == NODE_DELETED` and use `oldData` (carries the path and last-known data) to dispatch `event(configNamespace, oldData.getPath(), null, registerPath, EventType.DELETE)`. Only guard on `data` for PUT events.
-
Confidence: High
- Related existing: none — #6526/#6525 are in `shenyu-registry` (discovery registry), not `shenyu-sync-data-zookeeper` (config sync). Different component.
---
_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
Research direction
Read shenyu-sync-data-center/shenyu-sync-data-zookeeper/src/main/java/org/apache/shenyu/sync/data/zookeeper/ZookeeperSyncDataService.java around lines 86 and 102-112, starting with the CuratorCacheListener lambda and its null-data guard. Verify that NODE_DELETED events use oldData and reach the DELETE dispatch, while PUT events retain their data guard; done means deletions no longer remain active in the local cache.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100