[FLINK-39890] Fix NaN in observed scaling coefficient when baseline rate is zero#1134
[FLINK-39890] Fix NaN in observed scaling coefficient when baseline rate is zero#1134lrsb wants to merge 1 commit into
Conversation
Dennis-Mircea
left a comment
There was a problem hiding this comment.
Do you have a real reproduction for this? From I checked, in a real case scenario the baselineProcessingRate will never reach this code as 0.
|
Yes, this is actually addressing prod issue we encountered. If you are asking for steps is can try to create a simple case. |
Thanks, I believe you hit a real An idle vertex doesn't report With that, your current guard doesn't catch it:
So this patch would not fix the prod crash. The fix needs to handle non-finite values. Either guard the result ( |
What is the purpose of the change
When
job.autoscaler.observed-scalability.enabledistrue, the autoscaler throws aNumberFormatExceptionwhile computing the observed scaling coefficient for any vertex with a zero true-processing-rate (idle / very low traffic). The exception aborts the entire scaling pass, so no parallelism overrides / resource requirements are applied and the job stays stuck at its deployed parallelism.The root cause is in
AutoScalerUtils.optimizeLinearScalingCoefficient: the denominator issquaredSum * baselineProcessingRate, but onlysquaredSumis guarded against zero. An idle vertex reports a finite true processing rate of0.0(passing the caller'sisNaNguard), givingbaselineProcessingRate == 0.0andsum == 0.0. The result isalpha = 0.0 / 0.0 = NaN, whichMath.max/Math.mindo not sanitize, so it reachesBigDecimal.valueOf(NaN)and fails.This change guards the full denominator so a zero baseline (or zero
squaredSum) falls back to linear scaling.Brief change log
squaredSum * baselineProcessingRateinAutoScalerUtils.optimizeLinearScalingCoefficient, returning the linear-scaling fallback (1.0) when it is zeroVerifying this change
This change added tests and can be verified as follows:
testCalculateScalingCoefficientWithZeroProcessingRateFallsBackToLineartoJobVertexScalerTest, which builds a scaling history of vertices with a zero true-processing-rate and assertscalculateObservedScalingCoefficientreturns the linear-scaling coefficient1.0instead of producingNaNDoes this pull request potentially affect one of the following parts:
CustomResourceDescriptors: noDocumentation