Skip to content

feat(launch): warn when an instance is too small to enforce its own TTL (#682) - #709

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/682-spored-memory-floor
Oct 5, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/682-spored-memory-floor

Conversation

@scttfrdmn

@scttfrdmn scttfrdmn commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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

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.

Your 0.5 GiB instance wedged during a package install and was still running at twice its 6-minute TTL, with no completion.json, no command.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:

⚠️  t4g.nano has 0.5 GiB of memory, below the 1 GiB spored needs to be relied on.
   spored enforces TTL, idle and cost limits from inside the instance, so a box too
   starved to make progress is also too starved to stop itself. One wedged during a
   package install and ran to TWICE its TTL before a human killed it (#682).
   Your --ttl 6m may therefore not be enforced on this instance.
   The out-of-band reaper is the only backstop: check this account has one with
   'spawn doctor', or use a larger instance type.

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 --mpi precedent (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 launch has no --container flag 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. --mpi is 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 ensureIAMProfile and ensureSecurityGroup. 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 DescribeInstanceTypes with a size-suffix fallback (mirroring resolveArchitecture), 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.

@scttfrdmn
scttfrdmn force-pushed the fix/682-spored-memory-floor branch from 4bde5e9 to 08d9aff Compare October 5, 2026 04:31
…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
scttfrdmn force-pushed the fix/682-spored-memory-floor branch from 08d9aff to 2ac1d49 Compare October 5, 2026 04:43
@scttfrdmn
scttfrdmn merged commit f2b3457 into main Oct 5, 2026
6 checks passed
@scttfrdmn
scttfrdmn deleted the fix/682-spored-memory-floor branch October 5, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant