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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to