Repository navigation
Description
What happened
Launched with --fsx-create --fsx-lifecycle ephemeral, whose help text states the filesystem is "reaped when this instance terminates". The instance terminated; the filesystem did not. It sat at AVAILABLE, 1200 GiB, and had to be deleted by hand.
spawn launch fsxcmp --region us-west-2 --instance-type c8g.4xlarge \
--fsx-create --fsx-s3-bucket cookbook-942542972736-us-west-2 \
--fsx-import-path s3://cookbook-942542972736-us-west-2/inputs/bwa-real \
--fsx-storage-capacity 1200 --fsx-throughput 125 \
--fsx-lifecycle ephemeral --fsx-mount-point /mnt/fsx \
--command '...' --ttl 75m --cost-limit 2.50 --on-complete terminateSequence, with the caveat stated up front:
- Instance
i-02101b630f2031e2flaunched; filesystemfs-0d0d29cb9e4be40dfcreated (1200 GiB). - The instance's
--commandfailed immediately (separate issue), so the instance idled. spawn terminate fsxcmp -y→ instanceterminated(confirmed viadescribe-instances).aws fsx describe-file-systemsstill showedfs-0d0d29cb9e4be40df— firstCREATING, thenAVAILABLE— with no instance attached.spawn fsx listshowed it too, still tagged with stack namefsxcmp.spawn fsx delete fs-0d0d29cb9e4be40dfworked and reported deletion initiated.
The caveat, because it may be the trigger: I terminated the instance while the filesystem was still in CREATING. It is plausible the reaper only fires on a normal completion path, or refuses to act on a filesystem that is not yet AVAILABLE and then never revisits it. If so, the bug is the missing retry rather than the reap itself — an ephemeral filesystem that finishes creating after its instance is gone has no remaining owner and nothing will ever delete it.
Why it matters more than the usual cleanup nit
spawn fsx list still knew the stack name, so the association was not lost — only unacted on. And the spend is not small or self-limiting:
- 1200 GiB is the minimum FSx Lustre size, ~$0.145/GiB-month ≈ $174/month for something the user believes is ephemeral.
--cost-limitcannot catch it. Its own help says "compute cost only", so a 1.2 TiB filesystem is invisible to the cap that a user reasonably assumes bounds the launch.--estimate-onlylikewise reported only the instance (TTL cost: $0.80) and said nothing about the filesystem it was about to create.- It is silent. Nothing in the terminate output mentions the filesystem, so the natural assumption after
spawn terminateis thatephemeraldid its job.
Suggested
- Reap
ephemeralfilesystems whenever their instance is gone, not only on the happy path — a reconcile pass that deletes anyephemeral-tagged filesystem whose instance no longer exists would cover theCREATINGrace and any other early exit. - Say something on terminate:
spawn terminateprinting "also deleting ephemeral filesystem fs-… (1200 GiB)" — or a warning when it can't — would make the leak visible at the moment the user is watching. - Include FSx in
--estimate-onlyand, if possible, in--cost-limit. A flag that creates a $174/month resource should surface it in the cost preview; at minimum the estimate should name it even if the cap can only track compute.
Found while measuring copy-vs-mount data paths (FSx Lustre vs EFS vs lith vs aws s3 cp) for the scientific-codes-cookbook. spawn 0.111.1, us-west-2.
Activity
scttfrdmn commentedon Sep 26, 2026
Investigated. Your caveat was a good instinct but the
CREATINGrace isn't the cause — the code already handles it. There are three separate true findings here, and the one that caused this leak is operational.1. The reaper never looks at your account (this is the actual cause)
The ephemeral-FSx reclamation you were relying on lives in the
ttl-reaperLambda, and it already covers exactly your scenario:lambda/ttl-reaper/main.gohas an ephemeral-orphan 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): anfsx-lifecycle=ephemeralfilesystem older than a 30-minute grace is eligible regardless of max-age, precisely because an ephemeral FSx carries nottl-deadlineand relies on refcount→0.fsxInUsecounts both leases —spawn:fsx-id(mounted) andspawn:fsx-pending(written at launch while spored waits for AVAILABLE). So a healthy provisioning filesystem is protected during its window, but once the instance is gone neither tag exists on any live instance → refcount 0 → eligible.So a
CREATINGfilesystem whose instance vanished is exactly what that net is for. It didn't fire because the reaper doesn't scan account 942542972736:resolveAccountsbuilds its account list statically from those two env vars. Enforce mode ✅, region ✅, code ✅ — account coverage ❌. The single deployed reaper (spawn-ttl-reaper-production, infra account, us-east-1) has never looked at the account you launch in.This is bigger than FSx. The reaper is the out-of-band backstop for the whole "everything dies eventually" invariant. In 942542972736 there is no backstop for any orphan class — past-TTL instances included. spored is the primary enforcer and normally works, which is why this hasn't bitten harder; your 1.2 TiB filesystem is just the first orphan expensive enough to notice.
2.
--fsx-lifecycle ephemeral's help text overpromisesIt says "reaped when this instance terminates". But
cmd/terminate.gocontains no FSx handling at all — nothing reaps at terminate time. The reclamation is entirely asynchronous, best-effort, grace-delayed, and contingent on reaper infrastructure covering your account. Your assumption afterspawn terminatewas the only reasonable reading of that text; the text is wrong. Your ask 2 is the right fix, and I'd add correcting the flag help.3. FSx really is invisible to the cost controls
Confirmed:
--cost-limitis compute-only by its own admission, and--estimate-onlynever mentions the filesystem it's about to create. A flag that provisions a ~$174/month minimum-size resource should name it in the preview even if the cap can only track compute. Ask 3 stands.What I'd do
spawn-ttl-reaper-ec2role there trusting the reaper withExternalId=spawn-ttl-reaper, then its ARN added toREAPER_ROLE_ARNS. This is the fix that actually closes the leak, and it closes it for every orphan class, not just FSx.--fsx-lifecyclehelp, and havespawn terminatereport the associated ephemeral filesystem — including when it can't confirm reclamation.--estimate-only(and note the cap's compute-only scope at the point of use, not only in flag help).Worth saying plainly: nothing here was a code defect in the reap logic. The leak happened because the safety net isn't installed where you work, and the CLI told you it was automatic. Thanks for the precise sequence — the
CREATINGdetail is what let me rule the race in and then back out.fix(fsx): stop promising synchronous ephemeral reaping; surface FSx i…
chore(release): v0.111.4
feat(status): list every billable resource, not just the instance
feat(status): list every billable resource, not just the instance
feat(status): list every billable resource, not just the instance (#634)
feat(reaper): publish the Lambda artifact, and grant the permissions …
feat(cost): --cost-limit covers storage, not just compute (#640)
scttfrdmn commentedon Oct 4, 2026
Root cause identified: the reaper has no coverage of that account at all
Found while investigating #652. The production reaper's own log line settles it:
Accounts:1— the reaper scans exactly one account,435415984226, which is the only entry inREAPER_ROLE_ARNS. The filesystem in this report was in 942542972736. The reaper never had visibility into it, so the #210 ephemeral-orphan net could not have caught the orphan no matter how it behaved.FSxScanned:0on every invocation confirms the FSx path is not failing — it is never reaching that account's filesystems in the first place.Why that account can't simply be added
942542972736 is the account whose organization forbids external-account trust. Adding it to
REAPER_ROLE_ARNSrequires deployingttl-reaper-cross-account-role.yamlthere, i.e. a role trusting the infra account — which is exactly what produced an automated security finding in 12 minutes, with the org's tooling flipping the trust policy to Deny. Least-privilege didn't help; the objection was the external principal itself.So this is not a configuration oversight. It is the structural gap that #624 (make coverage detectable) and #625 (
spawn reaper deploy— a supported in-account reaper needing no cross-account trust) exist to close. Both have shipped. The remaining step for this account is to actually runspawn reaper deployin it, which gives it a backstop without any trust relationship.What that means for this issue
The ephemeral-FSx reaping logic is not demonstrated broken by this report — it was never exercised. Two things are worth separating:
sporedcould not delete the filesystem itself. It dies with the instance, so anything outliving the instance is by definition out of its reach — that part is working as designed, and is why the reaper backstop exists.I'd suggest this issue stays open until
spawn reaper deployhas been run in 942542972736 and a deliberate ephemeral-FSx orphan is confirmed reaped there. That is the test that would actually prove the #210 net works, and it is cheap to run.Unrelated discrepancy noted while here
deployment/cloudformation/ttl-reaper-cross-account-role.yamltag-conditionsfsx:DeleteFileSystemonaws:ResourceTag/spawn:managed, whilepkg/reaperiam's scan-self policy states FSx cannot be tag-conditioned for that action and relies on the reaper's in-code guard instead. One of those is wrong. It is not implicated here (the call was never made), but if the condition is ineffective the cross-account role is less constrained than it reads, and if it is effective then the scan-self comment is wrong and that policy is looser than it needs to be. Folding the reconciliation into #652, which is already extending the drift gate to cover both roles.fix(reaper): grant ssm: on the cross-account role so REAPER_GRACEFUL …
fix(reaper): grant ssm: on the cross-account role so REAPER_GRACEFUL …
scttfrdmn commentedon Oct 5, 2026
Re-verified against a built binary today — all three code findings are shipped
Picking this up to close out, I re-checked each of the three rather than trusting the earlier write-up.
Finding 3 (FSx invisible in the cost preview) — fixed. Your original launch, as an estimate:
That is the $174/month you calculated by hand, now printed before anything is created.
--cost-limitcovers storage as well as compute and refuses a launch whose storage alone exceeds the cap, with--allow-cost-limit-overrunas the explicit opt-out. The one honest limitation is stated rather than papered over: the cap can refuse the filesystem but cannot reclaim it.Finding 2 (terminate said nothing) — fixed.
cmd/fsx_lease.goreads both leases off the instance tags, describes the filesystem for size and state, and prints the id, the monthly cost, the lifecycle's actual reclamation semantics, andspawn fsx delete <id>. Deliberately read-only — terminate reports, it does not delete as a side effect.Finding 1 (the
CREATINGrace) — was already handled. Your caveat was a good instinct but not the cause:fsxInUsecountsspawn:fsx-pendingas well asspawn:fsx-id, and the #210 ephemeral-orphan net makes an ephemeral filesystem eligible after a 30-minute grace regardless of max-age. A filesystem that finishes creating after its instance is gone is exactly what that net is for.What is actually left, and the decision that now resolves it
Nothing in the code. The leak happened because no reaper scanned 942542972736 — and as recorded above, that account's organization forbids trusting an external principal, so it cannot be added to
REAPER_ROLE_ARNS.That question has now been settled in the general case: the reaper should be in-account, CLI-converged and durable, with the infra account as a read-only observer. Three reasons, and the first is this issue:
spawn reaper deployalready implements this and installs unarmed (dry-run) by design. The remaining step for this issue is operational — deploy it into that account, read a cycle of dry-run logs, then arm — and I am not doing a live deploy without asking first.Leaving this open on the operational step rather than closing it, since the symptom you reported is only genuinely gone once something is actually reclaiming filesystems in that account.
scttfrdmn commentedon Oct 5, 2026
The operational gap is closed. An in-account reaper is deployed and armed in 942542972736 / us-west-2 — the exact account and region where your 1.2 TiB filesystem sat.
Deployed
This is the in-account shape, so it resolves the blocker recorded above: the account's organization forbids trusting an external principal, and this trusts nothing but Lambda. Verified against the deployed artifact rather than the template:
lambda.amazonaws.comonly — zero matches for any spore.host account id,ExternalId, or an"AWS"principal.sts:AssumeRoleat all.AWSLambdaBasicExecutionRole(logs).accounts=[self]in the runtime log confirms it never assumes anything.IAM simulated in both directions, because an applied policy is not an authorized one:
TerminateInstancesonspawn:managed=trueTerminateInstancesonspawn:managed=falseTerminateInstanceswith no tagsts:AssumeRoleinto 966362334030fsx:DescribeFileSystems/DeleteFileSystems3:DeleteBucket,iam:CreateRole,ec2:RunInstancesValidated end to end, both directions
Three dry-run cycles came back clean — but every one scanned an empty account (
Scanned:0), so they proved the reaper runs and authorizes and nothing about whether it classifies correctly. It had never evaluated a single resource.So after arming I gave it one
t4g.nanoto look at, launched withaws ec2 run-instancesrather thanspawn launchdeliberately — no spored. With spored installed, in-instance enforcement would have terminated it and the result could not be attributed. This way the reaper is the only actor.Sparing a live instance (the half that matters, and the one with real consequences — #650 disarmed the production reaper, and the mirror-image bug kills running jobs):
Seen, evaluated, judged unexpired, left alone.
Reaping an expired one, after moving the deadline five minutes into the past:
Independent leak-check afterwards: 0 non-terminated instances, 0 available volumes, 0 FSx filesystems in the region. Total cost of the validation was a fraction of a cent.
Two caveats worth your attention
REAPER_REGIONS=us-west-2only. Your leak was there, so it is covered — but a launch into any other region in this account is still unbackstopped.max-age=168h,graceful=false. An instance with nospawn:ttl-deadlineis reclaimed after 7 days regardless, and it terminates rather than stopping first.Still open on this issue
Nothing in spawn's code, and nothing operational for us-west-2. What remains is the thread this issue fed into: nothing reaps the reaper's own leavings — the role, the schedule, and the
spawn-reaper-artifacts-942542972736-us-west-2bucket this deploy created, holding a 25 MB artifact. That belongs to "who reaps the reapers" rather than here, and this deployment just added one more instance of it.scttfrdmn commentedon Oct 9, 2026
Verified end to end today. Closing.
All three code findings are shipped, and the operational gap — the one that
actually caused this leak — is confirmed live rather than merely deployed.
Code, re-checked against
maintodaylambda/ttl-reaper/main.go:890,ephemeralOrphanGrace = 30m(#210)fsxLeaseNoticeFor→renderFSxLeaseNotice, printing size, ~monthly cost, and lifecycle-specific wording (ephemeral/durable/ untagged)cmd/fsx_cost.goThe in-account reaper is firing, not just present
This is the part worth checking properly: a reaper that is deployed and armed but
never invoked looks identical to a working one from its configuration alone.
The filesystem, and the account
Two caveats that remain true
REAPER_REGIONS=us-west-2only. Your leak was there, so it is covered, buta launch into any other region in that account is still unbackstopped.
REAPER_MAX_AGEis unset, so the function's built-in default applies, andreclamation terminates rather than stopping first. An instance with no
spawn:ttl-deadlineis still reclaimed eventually, by that default rather thanby an explicit setting.
Where the remainder went
This issue's last comment identified the genuine leftover as "nothing reaps the
reaper's own leavings" — the role, the schedule, and the
spawn-reaper-artifacts-942542972736-us-west-2bucket this deploy created. Thatis #653, which is now moving: #770 bounds the one control-plane artifact measured
to grow without limit (10 log groups with no retention, 51 MB), and the
measurement there corrected two of #653's own priorities.
fix(reaper): trust the reaper by name pattern, not a generated role ARN
fix(reaper): trust the reaper by name pattern, not a generated role A…
feat(reaper): report an idle reaper, and allow scheduled self-removal (…
Gate the reaper's YAML IAM copies against pkg/reaperiam; fix the SAM …
Gate the reaper's YAML IAM copies against pkg/reaperiam; fix the SAM …
Gate the reaper's YAML IAM copies against pkg/reaperiam; fix the SAM …
Gate the reaper's YAML IAM copies against pkg/reaperiam; fix the SAM …