Aias00 opened a new issue, #7701: URL: https://github.com/apache/shenyu/issues/7701
### Current behavior `TaskSchedulerManager` manually creates and initializes a `ThreadPoolTaskScheduler`. Its public `shutdown()` is not called anywhere in production code and is not registered through `@PreDestroy`, `DisposableBean` or a bean destroy method. The nested scheduler is not itself a managed Spring bean. ### Location [TaskSchedulerManager.java:39–43,80–82](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/scale/scaler/dynamic/TaskSchedulerManager.java#L39). ### Reproduction / validation A standalone Java probe compiled the current manager, registered it in a real `AnnotationConfigApplicationContext`, registered a delayed periodic task, then closed the context. Inspecting the underlying scheduled executor after context close produced: ```text EXECUTOR_SHUTDOWN_AFTER_CONTEXT_CLOSE=false ``` The probe explicitly called `manager.shutdown()` afterward to clean up its own process. A separate reviewer independently confirmed there is no production caller or lifecycle hook for the method. ### Impact / priority **P2 / Medium; confirmed, high confidence.** Once monitoring starts, its default non-daemon executor thread remains alive after context close. Embedded/admin context restarts can retain monitoring tasks and old contexts; normal graceful termination can remain alive waiting for this thread. An external process kill is not prevented by this issue. ### Suggested fix Bind manager shutdown to Spring destruction, or expose the scheduler as a managed bean. Cancel active tasks and shut down the executor deterministically; lifecycle cleanup should also work when a dynamic policy has been disabled. ### Related existing work Searched all historical issue titles and live `TaskSchedulerManager` queries; no direct match. #5521 is the autoscaling feature task. This is application lifecycle ownership, distinct from failure to cancel a task when the final policy is disabled. ### Reviewed revision Apache ShenYu 2.7.2-SNAPSHOT, `master@66d7d954ca37d651a5ad916f988a8081157a7ab4`. This repository review excludes unit-test and CI issue categories. -- 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]
