Aias00 opened a new issue, #6721:
URL: https://github.com/apache/shenyu/issues/6721

   - Severity: Medium
   - Location:
   
`shenyu-web/src/main/java/org/apache/shenyu/web/handler/ShenyuWebHandler.java:169`
 (`this.sourcePlugins.addAll(...)`), `:185` (`this.sourcePlugins.set(i, ...)`), 
`:240` (`onPluginEnabled` synchronized, reads `sourcePlugins`)
   - 
   Description:
   `putExtPlugins` (line 150, **not** synchronized) mutates 
`this.sourcePlugins` (an `ArrayList`, not thread-safe) via `addAll` and `set`. 
Meanwhile `onPluginEnabled` (line 240, `synchronized`) reads `sourcePlugins` 
via `.stream()`. `putExtPlugins` is called from `ShenyuLoaderService`'s 
scheduled executor thread (unsynchronized) and from `onPluginEnabled` itself. 
When the scheduled path runs concurrently with `onPluginEnabled`, the 
unsynchronized `ArrayList` mutation can race with `stream()` iteration → 
`ConcurrentModificationException`, lost updates, or corrupted internal array 
state.
   - 
   Impact:
   During concurrent plugin loading and enable/disable events: CME (500 
errors), missing/duplicate plugins in chain, inconsistent plugin state.
   - 
   Suggested fix:
   Make `putExtPlugins` `synchronized`, or use `CopyOnWriteArrayList` for 
`sourcePlugins`.
   - 
   Confidence: High
   - Related existing: PERF-14 covers `BaseDataCache` list mutation races, a 
different class.
   
   ---
   
   ## B. shenyu-plugin-base (4 findings)
   
   ---
   _Identified during the 2026-08-02 deep re-scan; full list in 
[`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.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