You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "Aias00 (via GitHub)" <gi...@apache.org> on 2026/08/02 12:11:14 UTC
[I] [BUG] BaseDataCache.removeSelectData/removeRuleData mutate live list in place while readers iterate unsynchronized (CME risk) [shenyu]
Aias00 opened a new issue, #6570:
URL: https://github.com/apache/shenyu/issues/6570
## Description
`removeSelectData`/`removeRuleData` mutate the live `ArrayList` in place under `synchronized(SELECTOR_MAP)`, while `AbstractShenyuPlugin.execute` streams the same list (`matchSelector`/`matchRule`) without synchronization. Concurrent `removeIf` (structural modification) on an `ArrayList` while another thread streams it can throw `ConcurrentModificationException` and/or skip/duplicate entries. Note `selectorAccept` (the update path) correctly replaces the reference atomically — only the remove path mutates in place.
## Location
```
shenyu-plugin-base/.../cache/BaseDataCache.java:133-140 (removeSelectData), 191-198 (removeRuleData)
readers at :173-174 (obtainSelectorData), AbstractShenyuPlugin.matchSelector/matchRule
```
## Impact
During config sync that deletes selectors/rules, concurrent requests matching that plugin can throw CME -> 500/exception and/or skip/duplicate entries. Both a correctness and a latency issue (errors under load during sync).
## Suggested fix
Make `removeSelectData`/`removeRuleData` replace the reference with a new immutable list (like `selectorAccept` already does), or use `CopyOnWriteArrayList`, so readers never observe in-place mutation.
## Related existing issue(s)
#6351 was a CME in a heartbeat subscriber (`ShenyuClientURIExecutorSubscriber`), a different class/path.
_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [BUG] BaseDataCache.removeSelectData/removeRuleData mutate live list in place while readers iterate unsynchronized (CME risk) [shenyu]
Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
Aias00 closed issue #6570: [BUG] BaseDataCache.removeSelectData/removeRuleData mutate live list in place while readers iterate unsynchronized (CME risk)
URL: https://github.com/apache/shenyu/issues/6570
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [BUG] BaseDataCache.removeSelectData/removeRuleData mutate live list in place while readers iterate unsynchronized (CME risk) [shenyu]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #6570:
URL: https://github.com/apache/shenyu/issues/6570#issuecomment-5157757298
👋 Hello @yuluo-yx
A new issue has been opened by @Aias00:
- **Title**: [BUG] BaseDataCache.removeSelectData/removeRuleData mutate live list in place while readers iterate unsynchronized (CME risk)
- **Link**: https://github.com/apache/shenyu/issues/6570
Please review when you have time. Thank you! 🙏
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [BUG] BaseDataCache.removeSelectData/removeRuleData mutate live list in place while readers iterate unsynchronized (CME risk) [shenyu]
Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
Aias00 commented on issue #6570:
URL: https://github.com/apache/shenyu/issues/6570#issuecomment-5930767339
Closing as fixed by #7019. `BaseDataCache` removal now replaces cached lists instead of mutating live lists that readers may be iterating.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org