Repository navigation
feat(launch): warn when an instance is too small to enforce its own TTL (#682) - #709
Merged
Merged
Conversation
scttfrdmn
force-pushed
the
fix/682-spored-memory-floor
branch
from
October 5, 2026 04:31
4bde5e9 to
08d9aff
Compare
…TL (#682) spored enforces TTL, idle and cost limits from INSIDE the instance, so a box too starved to make progress is also too starved to run the loop that would kill it — the enforcement mechanism and the thing it must survive are the same resource. A 0.5 GiB instance wedged during a package install and was still running at TWICE its 6-minute TTL, with no completion record and no signal of any kind, until a human noticed and killed it. From the outside that is indistinguishable from a long-running job, which is what makes it worth saying out loud. Below 1 GiB, launch now warns before any AWS resource is created, names the specific --ttl that may not hold, and points at 'spawn doctor' to check whether a reaper covers the account. A gate asserts the warning precedes ensureIAMProfile and ensureSecurityGroup: advice printed after the role and the security group exist is advice about a decision already paid for, which is the #685 mistake. A WARNING, not a refusal, on purpose. A nano instance running a trivial command works fine today, and the demonstrated failure needed a tiny box AND a heavy bootstrap together. spawn cannot see the second half — the Docker install was inside the user's --command, not a flag — so refusing on memory alone would block working launches to prevent a combination spawn cannot detect. That rules out the --mpi precedent the issue suggested. The floor is 1 GiB because 0.5 GiB demonstrably failed and 4 GiB demonstrably worked, and nothing in between was tested; a higher floor would be inventing evidence, and a test asserts the constant stays inside that evidence. Memory comes from DescribeInstanceTypes with a size-suffix fallback, mirroring resolveArchitecture, and an unresolved lookup says NOTHING rather than guessing — crying wolf on healthy instances would train the reader to skip the one warning that matters. The heartbeat half of #682 (making a starved instance visible rather than merely preventable) is deliberately not here; it belongs with the "who reaps the reapers" thread.
scttfrdmn
force-pushed
the
fix/682-spored-memory-floor
branch
from
October 5, 2026 04:43
08d9aff to
2ac1d49
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.
Addresses the preventable half of #682. Deliberately no closing keyword: the
heartbeat half is not here, so this must not auto-close the issue — see the end.
The shape of the failure
sporedenforces TTL, idle and cost limits from inside the instance. So a box too starved to make progress is also too starved to run the loop that would kill it: the enforcement mechanism and the thing it must survive are the same resource.Your 0.5 GiB instance wedged during a package install and was still running at twice its 6-minute TTL, with no
completion.json, nocommand.log, and no signal of any kind, until you noticed and killed it. From the outside that is indistinguishable from a long-running job, which is the part worth fixing.Below 1 GiB, launch now says so before any AWS resource exists:
The message names the consequence, not the size — "0.5 GiB is small" is something the user already knows from the type they typed; "nothing will stop this instance" is not. A test asserts that, because a message that only mentioned the size would read as a sizing nit.
Why a warning and not a refusal
You suggested the
--mpiprecedent (refuse up front, before spending). I went to implement it and it does not hold here.A nano instance running a trivial command works fine today. The demonstrated failure needed a tiny box and a heavy bootstrap together — and the heavy half was the Docker install inside your
--command, not a flag.spawn launchhas no--containerflag to key off; it cannot see what the command will do. So refusing on memory alone would block working launches in order to prevent a combination spawn cannot detect.--mpiis different precisely because spawn knows MPI was requested.Why 1 GiB
0.5 GiB demonstrably failed; your 4 GiB runs demonstrably worked; nothing in between was tested. 1 GiB is the point below which AL2023's own package transactions are unreliable, which is what starved it. A higher floor would be inventing evidence, and a test asserts the constant stays inside the range the evidence actually supports — so a later "let's be safe, make it 8 GiB" has to come with new evidence.
Two things the tests pin down
Ordering. The warning must precede
ensureIAMProfileandensureSecurityGroup. Advice printed after the role and the security group exist is advice about a decision already paid for — the exact mistake #685 was. Verified to fail when I move the call after them.Silence on an unknown type. Memory comes from
DescribeInstanceTypeswith a size-suffix fallback (mirroringresolveArchitecture), and an unresolved lookup says nothing rather than guessing. Warning on every instance whose memory could not be resolved would cry wolf on healthy launches and train the reader to skip the one warning that matters.Not in here
Your point (2) — a
spored-has-not-checked-in heartbeat — is the only thing that makes a starved instance visible rather than merely preventable, and you were right that it is the bigger piece. It belongs with the "who reaps the reapers" thread rather than bolted onto this. Point (1) — citing this in the reaper docs as the live demonstration that the backstop is not optional — I used in #613's closeout, where it is now the first of three reasons the reaper has to be in-account.