Jose Luis López created YARN-12022:
--------------------------------------

             Summary: CapacityOverTimePolicy rejects reservations within the 
quota when a user allocation is in progress at the end of the checked window
                 Key: YARN-12022
                 URL: https://issues.apache.org/jira/browse/YARN-12022
             Project: Hadoop YARN
          Issue Type: Bug
          Components: reservation system, resourcemanager
            Reporter: Jose Luis López


{{CapacityOverTimePolicy#validate}} rejects reservations that are far within 
the average and instantaneous limits when the user has an allocation in 
progress at the end of the checked window ({{reservation end + validWindow}}), 
or a periodic allocation that crosses the period boundary.

h3. Root cause
* The user's consumption is obtained with {{getRangeOverlapping(checkStart, 
checkEnd)}}. Both {{RLESparseResourceAllocation}} ({{headMap(end, true)}}) and 
{{PeriodicRLESparseResourceAllocation}} (the {{<= end}} unrolling condition) 
keep the step-up of an allocation in progress at {{checkEnd}} but drop its 
closing step, so the result is open-ended.
* {{validate}} then merges consumption and reservation over {{[Long.MIN_VALUE, 
Long.MAX_VALUE]}}, and {{merge}} appends a key at {{Long.MAX_VALUE}}. The 
open-ended allocation therefore extends to {{Long.MAX_VALUE}}.
* The integral loop computes {{value * (Long.MAX_VALUE - t)}} and 
{{integralDown.put(t + validWindow)}} at {{t = Long.MAX_VALUE}}; both overflow, 
and the integral check fails on garbage values.

{noformat}
PlanningQuotaException: Integral (avg over time) quota capacity 0.25 over a 
window of 86400 seconds,  would be exceeded by accepting reservation: ...
Caused by: PlanningException: RLESparseResourceAllocation: merge failed as the 
resulting RLESparseResourceAllocation would be negative, when testing: 
(-9223372036768375809=<memory:2123748267, vCores:2073973>) > 
(1791743400000=<memory:256000, vCores:250>)
  at 
RLESparseResourceAllocation.combineValue(RLESparseResourceAllocation.java:462)
  at RLESparseResourceAllocation.merge(RLESparseResourceAllocation.java:353)
  at CapacityOverTimePolicy.validate(CapacityOverTimePolicy.java:197)
{noformat}
({{-9223372036768375809}} is {{Long.MAX_VALUE + 86400000}} after overflow.)

h3. Reproduction
Policy: 24h window, 25% average, 75% instantaneous; cluster of 1000 containers.
* Non-periodic, real timestamps: user u1 reserves 10% for [t0+30h, t0+32h), 
then 10% for [t0+6h, t0+7h). The second reservation's checked window ends at 
t0+31h, while the first is in progress, and it is rejected.
* Periodic (1 day): three reservations of 5% from 23:30 to 00:30 each day; the 
third is rejected.
* Controls: with the first reservation at [t0+32h, t0+33h), or with the daily 
slot not crossing midnight (22:00-23:00), all reservations are accepted.

Reproducer tests 
({{TestCapacityOverTimePolicy#testUserAllocationInProgressAtEndOfCheckedWindow}}
 and {{#testPeriodicAllocationCrossingPeriodBoundary}}): 
https://github.com/joseluisll/hadoop/commit/ed07bf2a

h3. Possible fix (to discuss)
Bound the merge in {{validate}} to {{[checkStart, checkEnd]}} so the view is 
closed at {{checkEnd}}, and/or avoid computing the integral up to 
{{Long.MAX_VALUE}} (overflow of the running total and of {{currTime + 
validWindow}}).

This issue also makes {{TestCapacityOverTimePolicy}} cases fail or be rejected 
for the wrong reason at specific times of the day (see the linked test issue).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to