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

   ### Current behavior
   
   Policy `id=2` has begin/end timestamps, but `ScaleService.executeScaling()` 
checks the window only at the moment it is called. It does not schedule a 
callback for `beginTime`, or periodically reevaluate time-window policies. Its 
only production callers are startup initialization and the after-commit 
policy-update path.
   
   ### Locations / reachable trigger
   
   - 
[ScaleService.java:75–78](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/scale/scaler/ScaleService.java#L75)
   - 
[ScaleTaskInitializer.run()](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/scale/scaler/ScaleTaskInitializer.java#L64)
   - 
[ScalePolicyServiceImpl.applyPolicy()](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ScalePolicyServiceImpl.java#L102)
   
   1. Configure and enable a complete policy 2 whose begin time is in the 
future, with no higher-priority active policy.
   2. The update invokes `executeScaling()` before the window; the check fails 
and no task is registered.
   3. Let the begin time pass without another policy update or restart. No 
replica update is attempted.
   
   ### Evidence and impact
   
   **P2 / Medium; confirmed, high confidence.** A probe compiled the current 
ScaleService and TaskSchedulerManager, used a fully populated policy starting 
100 ms in the future, and substituted only KubernetesScaler's side-effect 
method with a counter. After waiting 250 ms, while still inside the configured 
window:
   
   ```text
   WINDOW_ENTERED_REPLICA_CALLS=0 SCHEDULED_TASKS=0
   ```
   
   An isolated reviewer independently enumerated the production callers and 
confirmed the missing scheduling path. No live cluster was involved. This 
isolates the activation bug from the separate null V1Scale request defect.
   
   ### Expected behavior / suggested fix
   
   An enabled future-window policy should be reevaluated when the window starts 
without requiring an unrelated operator action. Schedule/cancel an activation 
callback or implement a managed policy evaluator. Define restart behavior and 
make activation idempotent so repeated evaluation does not repeatedly rewrite 
replica counts. Preserve priority among active policies.
   
   ### Related existing work
   
   #5521 is the autoscaling feature task. #6624 concerns partial policy-cache 
state; #7698 concerns scale request construction; #7700 and #7701 concern 
stopping dynamic work. None creates the missing future-window activation. This 
is not an exact-millisecond inclusive/exclusive-boundary complaint.
   
   
   ### Reviewed revision
   
   Apache ShenYu 2.7.2-SNAPSHOT, 
`master@66d7d954ca37d651a5ad916f988a8081157a7ab4`. Unit-test and CI issue 
categories excluded.
   


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