Aias00 opened a new issue, #7700: URL: https://github.com/apache/shenyu/issues/7700
### Current behavior `ScaleService.executeScaling()` cancels `DynamicScalingTask` only inside its non-null active-policy branch. When there are no active policies it simply returns, leaving a previously registered dynamic task running. ### Location and trigger - [ScaleService.java:66–87](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/scale/scaler/ScaleService.java#L66) - `ScalePolicyServiceImpl.applyPolicy()` updates the cache and calls `executeScaling()` after a policy update commits. 1. Enable policy `3` with a positive monitor interval and no other active policy. 2. Disable that policy. 3. `getActivePolicy()` now returns null; the scheduled task remains registered and continues invoking `metricsMonitor.monitorMetrics()`. ### Validation and impact **P2 / Medium; confirmed, high confidence.** A standalone probe compiled the current `ScaleService` and `TaskSchedulerManager`, initialized a real `ScalePolicyCache`, enabled policy 3, then set its status to 0 and ran `executeScaling()` again: ```text TASKS_ENABLED=1 TASKS_ALL_DISABLED=1 ``` The unchanged scheduled task still owns the monitoring callback. An isolated reviewer independently confirmed the update path. Monitoring/Prometheus traffic and observer callbacks continue after disabling scaling. This issue does not claim a successful replica update while the separate uninitialized-scale-spec defect remains present. ### Suggested fix Cancel the dynamic task on the no-active-policy path. Make the transition from active dynamic policy to zero active policies explicitly stop monitoring, including when all policies are disabled after a database commit. ### Related existing work No matching historical/live scaling-disabled issue found. #5521 is the feature umbrella; #6624 concerns partial cached policy fields. This is a policy-state transition bug, distinct from scheduler cleanup at application shutdown. ### 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]
