Repository navigation
Conversation
A placeholder rolled back after a shim bind failure was subtracted from the application's allocated resource instead of its placeholder resource, and the partition kept counting it as a placeholder. The application could then report negative usage, move to Running before its gang was complete, and get stuck in Completing.
…lback count The tests only rolled back the last allocated placeholder, so clearing the placeholder timer while another placeholder is still allocated went unnoticed, as did decrementing the partition placeholder count for a normal allocation.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1190 +/- ##
==========================================
+ Coverage 83.31% 83.39% +0.07%
==========================================
Files 104 104
Lines 14652 14660 +8
==========================================
+ Hits 12208 12225 +17
+ Misses 2146 2139 -7
+ Partials 298 296 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
HuangTing-Yao
left a comment
There was a problem hiding this comment.
Thanks for the fix. The direction looks right, and I can reproduce the symptoms from the JIRA on the base commit. Three things I'd like to confirm:
-
No timer for a placeholder allocated again while Running
The JIRA calls this out as a known cost, but is it acceptable? On a long-running app the leftover placeholders hold resources until the app ends. Could the timer be restarted when the placeholder is allocated again? Also worth adding this trade-off to the code comment, which currently only explains why the timer is cleared. -
Timeout is reset while Accepted
Once a rollback bringsallocatedPlaceholderto zero the timer is cleared, and the next allocation starts a new one with the full timeout. If binds keep failing and it drops to zero each time, the gang timeout may never fire and the app stays in Accepted. A timeout in Accepted already takes the incomplete-gang path, so could we leave the timer alone in that state? -
Rollback of a placeholder with a replacement in flight
If the placeholder was already picked bytryPlaceholderAllocate, the rollback does not undo itsreleasedflag or the link to the real ask. The real ask stays allocated without being an allocation of the app, and the placeholder cannot be replaced or timed out after it is allocated again.removeNodeAllocationsreverses the same case and could be used as a reference. This is an existing gap: handle it here or in a follow-up JIRA?
|
Hi @wilfred-s , one design question. YUNIKORN-3316 excludes placeholders from the rollback in the shim: on an AssumePod failure a placeholder is failed, not rolled back. Is rescheduling a placeholder after a bind failure intended, or should it be failed like on the AssumePod path? If it should be failed, a guard in the shim would be the simpler fix. |
Clearing the timer once a rollback left no placeholder allocated reset the gang deadline in Accepted, and left a placeholder allocated again in Running without any timeout. The timer was only cleared because a started application without allocated placeholders took the timeout path that releases every allocation; choosing that path by application state alone removes the need to clear it.
Thanks for the review! I’ll address the first two points by updating the timeout logic directly, rather than clearing the timer during rollback. This should preserve the original timeout while preventing real allocations from being released when no placeholders remain. For the third point, I agree it’s an existing gap. I’ll track it in a follow-up JIRA to keep this PR focused. |
Summary
When the shim fails to bind a placeholder pod, it sends a
SCHEDULING_FAILED_ON_RMrelease. The core rollback incorrectly treats the placeholder as a normal allocation, subtracting it fromallocatedResourceinstead ofallocatedPlaceholderand leaving the partition placeholder count unchanged. Reallocating it then double-counts the placeholder.For a gang with two allocated 1-vcore placeholders, rolling one back gives:
allocatedResourceallocatedPlaceholderplaceholderAllocationsQueue and node usage remain correct, but the application may report incorrect resource usage, enter
Runningbefore all placeholders are allocated, or get stuck inCompleting.Change
allocatedPlaceholder.The placeholder timer keeps running after a rollback: the gang deadline still counts from the first placeholder allocation and covers placeholders allocated again. A started application can then time out with no placeholders allocated, which must not release its real allocations.
Tests
TestRollbackAllocationPlaceholder: verifies application accounting, user usage, and timer state.TestRemoveAllocationSchedulingFailedOnRMPlaceholder: verifies partition counts and that the application entersRunningonly after both placeholders are reallocated.TestTimeoutPlaceholderAfterRollback: verifies that the timeout still resumes anAcceptedgang and keeps aRunningapplication's real allocations.All three tests fail without the fix; race and deadlock tests pass.
Type of change
Jira issue
Jira ID : https://issues.apache.org/jira/browse/YUNIKORN-3509
AI Tooling
Generated by Claude Code (Opus 5.5)
How has this been tested?
make test_allwas run, and no failures reported.