apache / apache/shenyu

[BUG] RuleDataRefresh.refresh() NPE on null data / no-op on empty data (HTTP sync)

Open Beginner friendly
#6,663 1 comment 0 reactions 0 assignees View on GitHub
data-sync: http priority: high type: bug
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-http/src/main/java/org/apache/shenyu/sync/data/http/refresh/RuleDataRefresh.java:71-81`
-
Description:
Identical bug to SYNC-3 but for rules. `data.forEach(pluginDataSubscriber::unRuleSubscribe)` is called when `CollectionUtils.isEmpty(data)` is true. NPE if null, no-op if empty.
-
Impact:
HTTP sync refresh with empty/null rule group crashes or leaves stale rules.
-
Suggested fix:
Call `refreshRuleDataAll()` first, return early when empty.
-
Confidence: High

---
_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

Open shenyu-sync-data-center/shenyu-sync-data-http/src/main/java/org/apache/shenyu/sync/data/http/refresh/RuleDataRefresh.java and inspect lines 71-81 in refresh(). Compare the empty and null rule-group paths with the suggested refreshRuleDataAll() ordering. Done means HTTP sync clears stale rules for empty data and does not throw an NPE for null data.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.