Repository navigation
Closed
Labels
bugSomething isn't working
Description
Summary — CRITICAL: ephemeral FSx is created BEFORE the instance launch succeeds, so every capacity-failed launch orphans a 1.2 TiB FSx filesystem. Under lagotto's retry-on-capacity loop this exhausted the account's entire PERSISTENT_2 quota (100,800 GiB / 84 filesystems) in ~35 minutes and would cost ~$14,600/mo if left running.
What happened
Using the autonomous path (lagotto v0.42.0 --action spawn + spawn v0.57.0, ephemeral
--fsx-create via launcher.Provision, fsx_lifecycle: ephemeral):
- lagotto polls for g5.12xlarge capacity, calls
launcher.Provision. Provisionasync-creates the ephemeral FSx filesystem first, THEN callsRunInstances.RunInstancesfails withInsufficientInstanceCapacity(tried all 3 AZs).- The FSx that was just created is never reaped — the ttl-reaper (ttl-reaper must reclaim orphaned FSx Lustre filesystems (cost backstop; prerequisite for any FSx auto-create) #192) reclaims FSx tied
to a terminated instance, but here no instance ever launched, so the FSx has no owner
to trigger reclamation. It's orphanedAVAILABLE. - lagotto retries next poll → repeat. Each poll leaked ~3 filesystems (one per AZ attempt).
~35 min of polling → 84 orphaned PERSISTENT_2 filesystems = 100,800 GiB = the full account
quota, after which FSx-create itself started failing withServiceLimitExceeded.
Tags on every orphan: spawn:managed=true, spawn:fsx-lifecycle=ephemeral, no instance attached.
Why this is severe
- Silent cost fire: 84 × 1200 GiB PERSISTENT_2 @ ~$0.145/GiB-mo ≈ $14,600/month.
- Quota exhaustion: bricks all further FSx creation in the account/region until cleaned up.
- The retry pattern multiplies it: the bug is benign for a one-shot
spawn launchthat
fails once, but lagotto's whole purpose is to RETRY on capacity — so the autonomous flow
(the headline use case for ephemeral FSx) is exactly where it compounds fastest. - It defeats the "fail-closed lifecycle contract" (FSx auto-create: explicit lifecycle contract (ephemeral|durable), fail-closed, + canonical docs #193): a capacity failure should leave NO
billable resource behind, but it leaves a 1.2 TiB filesystem.
Root cause
Ordering + ownership: FSx is created before the launch is known to succeed, and ephemeral-FSx
reclamation is keyed on instance-termination — a path never reached when the launch fails.
Suggested fixes (any one closes the hole; defense-in-depth wants several)
- Create FSx only after a successful RunInstances (reorder in
Provision): reserve/launch
the instance first, create FSx once we know we have compute. Costs a bit of latency but no
orphans on capacity failure. - If FSx must be created first, tear it down on launch failure —
Provisionshould delete
the FSx it just created if the subsequent RunInstances fails (transactional/compensating). - Reaper safety net for ownerless ephemeral FSx: the ttl-reaper should reclaim any
spawn:fsx-lifecycle=ephemeralfilesystem that has had NO instance attached for N minutes
after creation (covers the "instance never launched" case, not just "instance terminated"). - lagotto-side: on a capacity-retry, don't re-create FSx every poll — but the spawn-side
fix is the right layer since--fsx-createis broken for any failed launch, lagotto or not.
Reproduction
# Any --fsx-create launch into a capacity-constrained instance type:
spawn launch x --instance-type g5.12xlarge --region us-west-2 \
--fsx-create --fsx-lifecycle ephemeral --fsx-s3-bucket <b> \
--fsx-export-path s3://<b>/out/ --fsx-mount-point /fsx ...
# When RunInstances hits InsufficientInstanceCapacity, the FSx remains AVAILABLE, orphaned.
# Repeat (or let lagotto poll) → quota exhaustion.Versions
spawn v0.57.0, lagotto v0.42.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
chore(release): v0.60.0
fix(reaper): grant cross-account role fsx:DescribeFileSystems + Delet…
scttfrdmn commentedon Jun 17, 2026
Fixed in spawn v0.60.0 ✅
Released — upgrade to spawn ≥ 0.60.0 to protect new launches immediately.
What changed (defense-in-depth):
launcher.Provision, the lagotto path) delete the just-created ephemeral FSx ifRunInstancesfails — a capacity failure now leaves no billable resource (the FSx auto-create: explicit lifecycle contract (ephemeral|durable), fail-closed, + canonical docs #193 fail-closed contract). A delete failure is surfaced loudly (🛑 … DELETE IT MANUALLY …) so a leak is never silent.spawn:fsx-lifecycle=ephemeralfilesystem with no referencing instance (neitherspawn:fsx-idnorspawn:fsx-pending) for > 30 min — covers "instance never launched" even if the teardown is missed.fsxInUsenow also counts thespawn:fsx-pendingprovisioning lease, so a healthy FSx is never reaped during its ~10-min mount window.Deployment status (verified live):
REAPER_DRY_RUN=false).AccessDenied-erroring in dry-run, so it had never actually reaped a filesystem. Fixed in fix(reaper): grant cross-account role fsx:DescribeFileSystems + DeleteFileSystem (#210) #212 (fsx:DescribeFileSystems+ tag-scopedfsx:DeleteFileSystem), dev-account role updated, reaper now runsErrors:0with the FSx scan working.Follow-up: lagotto#45 tracks a belt-and-suspenders improvement (don't create-and-tear-down an FSx on every capacity-retry poll) — not urgent now that the spawn-side hole is closed.
Closing as fixed.
refactor: create ephemeral FSx after RunInstances succeeds (#213) (#215)
scttfrdmn commentedon Jun 17, 2026
Reopening evidence: orphans STILL accumulate on the launcher.Provision (lagotto) path in v0.60.0
Ran lagotto v0.43.0
poll --daemonagainst spawn v0.60.0 (the release that closed this).Two
--action spawnwatches, both hittingInsufficientInstanceCapacityevery poll. After ~8poll cycles I found 24 orphaned PERSISTENT_2 filesystems, all:
spawn:managed=true,spawn:fsx-lifecycle=ephemeralspawn:fsx-idand NOspawn:fsx-pending(no instance ever attached, no provisioning lease)So the compensating-teardown (#210 fix item 1) did not fire — or not reliably — on the
headless
launcher.Provisionpath that lagotto uses. The daemon log shows the failure as:i.e. it failed inside Provision at the launch step (after FSx create), and the FSx was left
AVAILABLE with no teardown logged and no
🛑 DELETE IT MANUALLYwarning (so it's not evenhitting the "teardown failed" branch — it looks like teardown isn't being attempted on this
path/error).
Hypotheses for maintainer
launcher.Provision's capacity-failure branch (the lagotto/headless path) — or it's gated onan error type that
InsufficientInstanceCapacity(wrapped asprovision: launch: ...) doesn'tmatch.
launcher.Provisionnow "tried 3 AZ(s)" internally. If it createsone FSx then tries 3 AZs and only tears down on the last AZ's failure path (or creates per
AZ), the bookkeeping could leak. Worth checking whether FSx create happens once per
Provision call or interacts with the AZ retry loop.
may not be running in THIS account — there's no hosted reaper deployed here (lagotto#29), so
the 30-min net only exists where the hosted poller/reaper runs. For an end-user account with
only a local daemon, the reaper net is absent entirely → teardown-on-failure is the ONLY
protection, and it's the one that's not firing.
Point 3 is the kicker: in an end-user account (no hosted reaper), the compensating-teardown is
the sole defense, so if it misses on the Provision path, orphans accumulate unbounded exactly as
before — just slower than the pre-#210 flood (24 over 8 cycles vs 84, but same failure mode).
Cleaned up
Deleted all 24 (authorized). Quota recovered. But this should not be closed until teardown is
verified firing on the
launcher.Provisioncapacity-failure path in an account with NO hostedreaper.
Versions
spawn v0.60.0, lagotto v0.43.0
scttfrdmn commentedon Jun 17, 2026
Reopening: orphans still accumulate on the launcher.Provision (lagotto) path under v0.60.0 in an account with no hosted reaper — see evidence above. The teardown-on-launch-failure isn't firing for the headless/capacity-failure path, and the 30-min reaper net doesn't exist in end-user accounts (lagotto#29), so there's no backstop.
scttfrdmn commentedon Jun 17, 2026
Resolved by v0.61.0 (#213) — closing
The reopen evidence above was against v0.60.0, whose fix was create-FSx-then-teardown-on-failure (item 1). That approach is exactly what proved unreliable on the headless
launcher.Provisioncapacity-failure path. v0.61.0 (#213) replaced it with the structural fix this issue's "Suggested fixes" listed as option 1 — create the FSx only after a successfulRunInstances— so the create-then-teardown is no longer the primary defense.Verified in the shipped code (
pkg/launcher/provision.go, on the lagotto/headless path):validateEphemeralFSxruns the fail-closed contract up front (a bad config still fails fast, no launch).client.Launch(RunInstances) runs next; a capacity failure returns immediately here, before any FSx work.createAndAttachEphemeralFSxis only reached after a successful launch.So a capacity-failed launch (
InsufficientInstanceCapacity, the lagotto retry case) now issues zeroCreateFileSystemcalls — by construction. There is no filesystem to orphan, on either the CLI or the headlesslauncher.Provisionpath. This holds even in an end-user account with no hosted reaper — the concern that drove the reopen (point 3) — because nothing is created in the first place; the reaper net and the compensating-teardown are retained only as backstops for the narrow create-succeeds-but-instance-tagging-fails window.Consumer side: lagotto#45 (don't re-create FSx on every capacity-retry poll) is closed, and lagotto now ships on spawn ≥ v0.61.0 (v0.46.0 → spawn v0.62.0), so the autonomous path gets this by default.
Job arrays (
--count > 1) still create the shared FSx before dispatch — out of scope here (different lifecycle).Closing as fixed in v0.61.0.
fix: Provision tears down instance on post-launch failure (#220)
fix: Provision tears down instance on post-launch failure (#220) (#230)
feat(reaper): publish the Lambda artifact, and grant the permissions …