Repository navigation
fix(task): container memory floor + instance_health for Docker failures (#1180) - #1197
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…es (#1180) A container spec with only resources.cpu sized to t4g.nano, where the boot-time dnf install docker is OOM-killed, and the record blamed the application (app_error, not retryable). - Sizing: TaskSpec.SizingRequest() applies a 2 GiB floor (ContainerMemoryFloorGiB) to container tasks, also when memory_gib is lower; Size drops candidates below the requested memory. A pinned instance_type is honoured, with a warning below the floor. - Wrapper: a failed Docker install, service start or daemon wait sets RUNTIME_RC, skips pull/run, and classifies instance_health, now retryable. Fixes #1180
scttfrdmn
force-pushed
the
fix/1180-container-memory-floor
branch
from
October 19, 2026 22:50
b88373b to
0b864c3
Compare
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.
Experiment E1 (#1171) found that a container TaskSpec with only
resources.cpusized to t4g.nano (0.5 GiB). On that boxdnf install dockerwas OOM-killed in 3 of 3 runs, and the record saidapp_error/ not retryable.(a) Memory floor at sizing
taskproto.ContainerMemoryFloorGiB = 2. New methodTaskSpec.SizingRequest()returnsResourceswith the floor applied whencontaineris set and the effective memory (memory_gib plus headroom) is below 2 GiB.resources.instance_typepin is returned unchanged.spawn task runlooks up the pinned type's memory (InstanceMemoryMiB, the same lookup the A box too small to run spored cannot enforce its own TTL: 0.5 GiB instance outlived a 6m TTL by 2x, silently #682 spored-floor warning uses) and prints a warning to stderr if it's below the floor.taskproto.Sizenow also drops candidates whose known memory is below the requested memory. Before, it trusted the finder's MinMemory filter, so the floor now holds even if a finder ignores it.taskproto.Sizecall sites in cmd/task.go now passspec.SizingRequest().Why 2 GiB. E1 measured only two sizes: 0.5 GiB failed 3/3, and 4 GiB passed 3/3 with a ~66 s install. Nothing in between has been measured. 1 GiB is already the point below which spawn warns that AL2023's own dnf transactions are unreliable (
aws.SporedMemoryFloorMiB, #682). A container task runs that transaction plus a resident dockerd/containerd plus the workload, so flooring at exactly the bare-dnf line would leave no headroom. 4 GiB is the only measured-good value, but it would double the cheapest container box for every cpu-only container task on an unmeasured margin. 2 GiB is the smallest standard size (t4g.small, t3.small) above the 1 GiB line. The 2 GiB value has not been measured on AWS. Follow-up: #1199.(b) Docker failures are not app errors
dnf install -y docker,systemctl enable --now docker, or the 30-trydocker infowait now setsRUNTIME_RC. The wrapper then skips the pull and run, sets rc, and the classifier recordsinstance_health. It checks this after STAGE_RC and before rc. Before, each step's failure was ignored: the wrapper ransudo docker runanyway, got "command not found", and recordedapp_error.instance_healthand notstaging_error.staging_erroris documented as "an input S3 copy failed" and not retryable, and making it retryable would change the semantics for S3 input failures.instance_healthwas already defined and listed in the adapter RFC but nothing produced it. This is its first producer, and it's now retryable, so nothing that existed before changes behaviour. None of the Python or Java adapters switch on specific classes; I grepped the sibling repos.Gates, each watched failing against a compiling revert
TestGenerateWrapper_ContainerRuntimeFailureIsNotAppError(pkg/taskproto/wrapper_runtime_test.go) runs the whole generated wrapper under bash. PATH is only a stand-in directory, so a real docker on the CI host can't skip the install. It has three cases: dnf exits 137 with docker absent,docker infonever succeeds, and systemctl fails. Each asserts state failed, a class that is neither app_error nor empty, that the class is retryable, exit_code != 0, and that docker pull/run was never invoked.RUNTIME_RCelif from the classifier: all three cases fail withretry_class = "app_error".|| RUNTIME_RC=captures: dnf caseapp_error, the other two"".TestGenerateWrapper_ContainerCommandFailureStaysAppErrorchecks that with a working runtime, a command exiting 3 is still app_error/3.TestRenderTaskDryRun_ContainerCPUOnlySizesAtFlooruses a fake finder that returns the whole t4g ladder regardless of the request. A cpu-only container spec picks t4g.small and the dry run explains why. The same spec without a container still picks t4g.nano.TestRunTaskReal_ContainerAsksFinderForFlooruses a recording finder that stops the run. For both the real path and the dry-run path, the finder is asked for at least 2 GiB. runTaskReal sizes before touching AWS, so this test makes no AWS call.TestCmd_TaskprotoSizeUsesSizingRequestis an AST check. It discovers everytaskproto.Sizecall in cmd/*.go (excluding tests) and fails if it finds none. Each call's request argument must be<x>.SizingRequest().TestSizingRequest_ContainerMemoryFloorandTestSize_FiltersCandidatesBelowRequestedMemoryare unit tests in pkg/taskproto.TestContainerPinBelowFloorWarnscovers the warning cases: a pinned nano warns; a pin at the floor, a host task, an unpinned spec, and an unknown memory lookup don't.Reverts:
if false && ...): the SizingRequest, Size-filter, dry-run and finder tests fail.spec.Resources): the dry-run, finder and AST tests fail.Checks
make checkpasses steps 1–6. Step 7check-build-tagsfails here exactly as it does on an unmodified main worktree (the /private/tmp path issue).make gen-docswas run, and the help text change is committed.make check-docsis clean.make api-snapshotaddsContainerMemoryFloorGiBand(*TaskSpec).SizingRequest. Nothing was removed.semgrep scan --config=auto --error .is clean.API note
spore-host-mcp calls
taskproto.Size(ctx, finder, spec.Resources)and won't get the floor until it switches tospec.SizingRequest()after the next spawn release. The Size-side filter doesn't help it either, because with spec.Resources the requested memory is 0. Filed as spore-host/spore-host-mcp#60.Fixes #1180