Skip to content

CRITICAL: --fsx-create creates FSx BEFORE launch succeeds; capacity-failed launches orphan 1.2TiB filesystems → quota exhaustion + ~$14.6k/mo cost (compounds under lagotto retry) #210

Closed

Description

@scttfrdmn

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):

  1. lagotto polls for g5.12xlarge capacity, calls launcher.Provision.
  2. Provision async-creates the ephemeral FSx filesystem first, THEN calls RunInstances.
  3. RunInstances fails with InsufficientInstanceCapacity (tried all 3 AZs).
  4. 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 orphaned AVAILABLE.
  5. 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 with ServiceLimitExceeded.

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 launch that
    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)

  1. 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.
  2. If FSx must be created first, tear it down on launch failure — Provision should delete
    the FSx it just created if the subsequent RunInstances fails (transactional/compensating).
  3. Reaper safety net for ownerless ephemeral FSx: the ttl-reaper should reclaim any
    spawn:fsx-lifecycle=ephemeral filesystem that has had NO instance attached for N minutes
    after creation (covers the "instance never launched" case, not just "instance terminated").
  4. lagotto-side: on a capacity-retry, don't re-create FSx every poll — but the spawn-side
    fix is the right layer since --fsx-create is 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

Activity

  1. added
    bug
    on Jun 17, 2026
  2. scttfrdmn commented on Jun 17, 2026

    @scttfrdmn
    ContributorAuthor

    Fixed in spawn v0.60.0 ✅

    Released — upgrade to spawn ≥ 0.60.0 to protect new launches immediately.

    What changed (defense-in-depth):

    1. Compensating teardown (in the binary, effective on upgrade): both the CLI and the headless launcher (launcher.Provision, the lagotto path) delete the just-created ephemeral FSx if RunInstances fails — 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.
    2. Reaper safety net (ttl-reaper): reclaims any spawn:fsx-lifecycle=ephemeral filesystem with no referencing instance (neither spawn:fsx-id nor spawn:fsx-pending) for > 30 min — covers "instance never launched" even if the teardown is missed. fsxInUse now also counts the spawn:fsx-pending provisioning lease, so a healthy FSx is never reaped during its ~10-min mount window.

    Deployment status (verified live):

    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.

  3. scttfrdmn commented on Jun 17, 2026

    @scttfrdmn
    ContributorAuthor

    Reopening evidence: orphans STILL accumulate on the launcher.Provision (lagotto) path in v0.60.0

    Ran lagotto v0.43.0 poll --daemon against spawn v0.60.0 (the release that closed this).
    Two --action spawn watches, both hitting InsufficientInstanceCapacity every poll. After ~8
    poll cycles I found 24 orphaned PERSISTENT_2 filesystems, all:

    • spawn:managed=true, spawn:fsx-lifecycle=ephemeral
    • NO spawn:fsx-id and NO spawn:fsx-pending (no instance ever attached, no provisioning lease)
    • created during the daemon window (12:13–13:00)

    So the compensating-teardown (#210 fix item 1) did not fire — or not reliably — on the
    headless launcher.Provision path that lagotto uses. The daemon log shows the failure as:

    auto-spawn failed (capacity, will retry): launch instance (tried 3 AZ(s): [...]):
      provision: launch: failed to launch instance: InsufficientInstanceCapacity: ...
    

    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 MANUALLY warning (so it's not even
    hitting the "teardown failed" branch — it looks like teardown isn't being attempted on this
    path/error).

    Hypotheses for maintainer

    1. The compensating-teardown was wired into the CLI launch path but not into
      launcher.Provision's capacity-failure branch (the lagotto/headless path) — or it's gated on
      an error type that InsufficientInstanceCapacity (wrapped as provision: launch: ...) doesn't
      match.
    2. The AZ-loop matters: launcher.Provision now "tried 3 AZ(s)" internally. If it creates
      one 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.
    3. The reaper safety net (CRITICAL: --fsx-create creates FSx BEFORE launch succeeds; capacity-failed launches orphan 1.2TiB filesystems → quota exhaustion + ~$14.6k/mo cost (compounds under lagotto retry) #210 item 2: reclaim ephemeral FSx with no instance after 30 min)
      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.Provision capacity-failure path in an account with NO hosted
    reaper.

    Versions

    spawn v0.60.0, lagotto v0.43.0

  4. scttfrdmn commented on Jun 17, 2026

    @scttfrdmn
    ContributorAuthor

    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.

  5. scttfrdmn commented on Jun 17, 2026

    @scttfrdmn
    ContributorAuthor

    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.Provision capacity-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 successful RunInstances — 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):

    • Step 3.5 — validateEphemeralFSx runs the fail-closed contract up front (a bad config still fails fast, no launch).
    • Step 4 — client.Launch (RunInstances) runs next; a capacity failure returns immediately here, before any FSx work.
    • Step 5 — createAndAttachEphemeralFSx is only reached after a successful launch.

    So a capacity-failed launch (InsufficientInstanceCapacity, the lagotto retry case) now issues zero CreateFileSystem calls — by construction. There is no filesystem to orphan, on either the CLI or the headless launcher.Provision path. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions