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

   - Severity: High
   - Location:
   
`shenyu-web/src/main/java/org/apache/shenyu/web/handler/ShenyuWebHandler.java:150-191`
 (`putExtPlugins` — only add/update, no removal); 
`shenyu-web/src/main/java/org/apache/shenyu/web/loader/ShenyuExtPathPluginJarLoader.java:62-65`
 (calls `removePluginClassLoader` only); 
`shenyu-web/src/main/java/org/apache/shenyu/web/loader/ShenyuLoaderService.java:104-112`
   - 
   Description:
   When an ext-lib jar is deleted from disk, 
`ShenyuExtPathPluginJarLoader.loadExtendPlugins` calls 
`ShenyuPluginClassLoaderHolder.removePluginClassLoader(removePath)`, which 
closes the classloader and `destroySingleton`s its Spring beans. However, 
`ShenyuLoaderService.loaderPlugins` only calls 
`webHandler.putExtPlugins(newPlugins)` — and `putExtPlugins` has add and update 
branches but **no removal branch**. Plugin removal from the live 
`plugins`/`sourcePlugins` lists is only reachable via `PluginHandlerEvent` 
(DELETE → `onPluginRemoved`), which the ext-lib scan never publishes.
   - 
   Impact:
   The stale `ShenyuPlugin` instance from the destroyed classloader stays in 
`ShenyuWebHandler.plugins`. The next request dispatching to that plugin hits 
beans whose singletons were just `destroySingleton`'d and a classloader that 
was `close()`'d → `BeanCreationException`/`NoClassDefFoundError`/NPE for the 
whole route.
   - 
   Suggested fix:
   Have `loadExtendPlugins` return the removed plugin names; have 
`ShenyuLoaderService` call a new `webHandler.removeExtPlugins(names)` that 
filters `plugins`/`sourcePlugins` by `named()` (copy-on-write).
   - 
   Confidence: High
   - Related existing: WEB-08 covers a race in `sourcePlugins` construction, 
not the missing removal path.
   
   ---
   _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)._


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