Repository navigation
Closed
Milestone
Description
What happened
spawn launch (v0.135.1) created an on-demand g5.xlarge with --ttl 4h --cost-limit 5 --on-complete terminate. RunInstances succeeded: one CloudTrail event, no errorCode. The guest then never booted far enough to start spored; CloudTrail shows zero API calls from the instance, not even SSM registration. After about 7 minutes of post-launch checks, spawn returned:
instance … launched but spored never came up — it has NO TTL/idle safety net …
and exited non-zero without terminating the instance, because --terminate-on-error defaults to false. The caller saw a failed launch and moved on.
- Result: the instance ran about 74 hours, past its TTL and cost limit, at about $75 on-demand.
- Why nothing else stopped it: TTL and cost-limit enforcement lives only in spored, in the guest. The account's selfscan reaper was deployed with
REAPER_REGIONSset to one region, and the instance was in another.
Code references (HEAD 76ebc33)
cmd/launch_single.go:988→cmd/launch_posthook.go:405-429: on a verification failure, the instance is terminated only if--terminate-on-error, which defaults to false (cmd/launch_flags.go:445).cmd/launch_single.go:902, the WaitForRunning error, and:911, the GetInstancePublicIP error, return the error without terminating the instance. The--fsx-createpath inpkg/launcher/provision.go:174-182does terminate.cmd/launch_reaper_coverage.go(launchLeansOnReaper) warns about reaper coverage only for stop/hibernate or ephemeral FSx, never for--on-complete terminate.- The reaper code itself defaults to 11 regions (
pkg/reaperconfig/reaperconfig.go:189-196). The gap was a deployment setting.
Suggested fixes
- Terminate by default on any failure after RunInstances: verification, WaitForRunning, public-IP lookup. Keep an explicit opt-out (e.g.
--keep-on-error), and print the instance ID before anything else. - Warn or refuse when the launch region is outside the deployed reaper's coverage, for every on-complete mode. An instance whose guest never starts spored has only the reaper.
- (Optional) Reap early on a missing heartbeat: no heartbeat N minutes after launch reaps the instance, without waiting for the TTL deadline.
Test plan
- Unit tests with the
sporedSignalsfake and a fake terminator. With default flags, each of these must call Terminate exactly once: a verification timeout, a WaitForRunning error, and a public-IP error. The opt-out must skip Terminate. - Launch-time test: a region outside
DetectReaperCoveragetriggers the warning for--on-complete terminate. - Integration test: user-data that prevents the agents from starting; the CLI must terminate the instance within its verification budget.
Workaround for callers today: pass --terminate-on-error, and sweep by tag after any failed launch.
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(launch): terminate on any failure after RunInstances unless --ke…
feat(launch): terminate on any failure after RunInstances unless --ke…
SSM-first Linux launch/connect (#1296); terminate on failed launch by…
Let the #1298 defer gate find the launch through launchInstanceStep
Print a failed launch's error once; AWS's message in job-array member…