Skip to content

sweep resume reuses a spawn-instance-* profile name without re-creating it; fails if the role sweep deleted it #1385

Closed

Description

@scttfrdmn

Found while listing the deferred launchers for #1378. spawn sweep resume (and the deprecated spawn resume) can launch with a spawn-instance-* profile that the role sweep has since deleted.

Evidence (code): cmd/resume.go rebuilds the pending members from the sweep's local state (~/.spawn/sweeps/<id>.json) and its stored param file (buildLaunchConfigFromParams(... paramFormat.Defaults, paramSet ...)). A foreground sweep with --iam-policy/--s3-* has its iam_role seeded to spawn-instance-<hash> (applyCLIIAMToSweep). Resume calls SetupSporedIAMRole only when no profile is set (firstConfig.IamInstanceProfile == ""). It never re-creates a named spawn-instance-* role.

So if a sweep is interrupted, all of its launched members terminate, and the user resumes more than 24h later, an armed role sweep (#1300) may have deleted the role. The resumed members then fail at RunInstances with an invalid instance profile. The reference sits in a local file, which neither the reaper nor spawn cleanup can read, so #1378's schedule references can't cover it.

Not reproduced. The cost is a failed resume, not a leak.

Suggested fix: resume should re-derive the role with CreateOrGetInstanceProfile from the stored policy config (the name is a hash of it, so it re-creates the same role), as lagotto does at match time. The alternative is to store the policy config in the sweep state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lifecyclecomponent:spawntype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions