Repository navigation
Worker: soft memory enforcement against the reservation, and a disk guard before inputs are fetched - #2812
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… pod's cgroup limit does (cherry picked from commit 1006713c993859abadfe7a343bbe6380c5a07355)
(cherry picked from commit 9b564e17ed0e52402ab9561dd9475f8153446774)
… action (cherry picked from commit 8de19068ec6d050a4c347766c4ceac83e71db635)
…e before fetching its inputs (cherry picked from commit 3ae49eb55474465358ed67af4aa56c3057ec419f)
amankrx
force-pushed
the
pr/memory-enforcement
branch
from
September 29, 2026 05:54
4b7bc79 to
f49f17a
Compare
corcillo
reviewed
Sep 29, 2026
…, overlay properties only with enforcement on
corcillo
approved these changes
Sep 29, 2026
MarcusSorealheis
approved these changes
Sep 29, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
An action that grew past the memory the scheduler placed it by was killed by the pod's cgroup limit, and on cgroup v2 with
memory.oom.groupthat kill takes the worker and every action on it. Withresource_enforcement.memory: softthe worker samples the action's process group every 250 ms and kills it once two consecutive samples exceed the reservation plus headroom (default 20 percent), or one sample exceeds twice it, failing only that action withFAILED_PRECONDITIONnaming the reservation and the peak.disk: guardrefuses an action whose disk reservation exceeds the free space under the work directory before any input is fetched, asRESOURCE_EXHAUSTED, which the scheduler requeues untried. The sample is the group's proportional set size, so a parent's pages shared with its forked children count once. The guard counts what the admitted actions already reserved, so four actions dispatched into the same free space are not all admitted. Either axis works alone. With enforcement on, the worker reads the properties from the scheduler'sStartExecute.platformrather than the client's request, so the reservation enforced is the one the ledger charged. Actions run through a persistent worker are not covered by the ceiling, and the docs say so.How was this verified?
running_actions_manager_test: an action that allocates past its reservation is killed withFailedPreconditionnaming the figures (Linux only, like the sampler), an action reserving more disk than is free is refused before its inputs are fetched, a second action is refused while a first holds nearly all the free space and admitted once it has cleaned up, each config axis is honoured alone,Pssis parsed out ofsmaps_rollup, and the scheduler's properties reach an action's environment only with enforcement on. On a test cluster, eight actions ramping to 20 GiB with a 4 GiB reservation were each killed by the worker at 5.5 GiB with the pod still running and the client told the reservation and the peak within 40 seconds; before, the pod was OOM-killed and all eight were lost.Risk
Off unless
resource_enforcementis configured, and Linux only; the setting is accepted and ignored elsewhere. Samples are 250 ms apart, so an action allocating faster than the pod's whole limit in half a second can still reach the cgroup limit first. With enforcement off, the worker reads the client's properties as before, so an upgrade alone changes no action's environment.AI assistance
An agent drafted the change and I reviewed every line.
This change is