QiuYucheng2003 opened a new issue, #6262: URL: https://github.com/apache/shenyu/issues/6262
### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior I detected a thread pool misuse in `DisruptorProviderManage.java` using a static analysis tool. In the `startup(boolean isOrderly)` method, an `OrderlyExecutor` (a thread pool) is initialized as a local variable: `OrderlyExecutor executor = new OrderlyExecutor(...)` Although this executor is passed to `QueueConsumer`, the `DisruptorProviderManage` class does not retain a reference to it. Crucially, calling `disruptor.shutdown()` in `DisruptorProvider.shutdown()` does NOT automatically shut down external executors. Since the reference to `executor` is lost after the `startup` method returns, it is never explicitly shut down. This leads to a thread pool leak. If the component is restarted or refreshed, the old thread pool remains active, eventually leading to thread exhaustion or OOM. ### Expected Behavior The `OrderlyExecutor` should be managed properly to ensure resources are released: 1. It should be assigned to a class member variable in `DisruptorProviderManage` (e.g., `private OrderlyExecutor executor;`). 2. It should be explicitly shut down in the `shutdown()` logic (or pass the close responsibility to `DisruptorProvider` and call `executor.shutdown()` there). ### Steps To Reproduce 1. Open `org.apache.shenyu.disruptor.DisruptorProviderManage.java` (version 2.6.0). 2. Locate the `startup(boolean isOrderly)` method (around line 82). 3. Observe that `OrderlyExecutor executor = new OrderlyExecutor(...)` is a local variable and is not saved to any field. 4. Check `org.apache.shenyu.disruptor.provider.DisruptorProvider.java`. 5. Observe the `shutdown()` method: it only calls `disruptor.shutdown()`, leaving the `executor` threads running. ### Environment ```markdown ShenYu version(s):2.6.0 ``` ### Debug logs N/A (Issue detected via Static Code Analysis) ### Anything else? This issue was identified by a custom static analysis tool focused on thread pool lifecycle management. -- 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]
