Skip to content

A Spot replacement re-runs the embedded --command workload before spored can retire it #1007

Closed

Description

@scttfrdmn

Found while working on #995.

EC2 launches a replacement from a leaked persistent Spot request using the request's LaunchSpecification, and that includes UserData. spawn embeds --command in user data (/etc/spawn/command, #214/#246, pkg/launcher/bootstrap.go). The bootstrap starts that workload in the background before systemctl start spored. So a replacement re-runs the user's workload from the start, with its side effects (S3 writes, queue consumption, external calls), while spored is still deciding whether it is a replacement. With #995, spored then cancels the request and shuts down, possibly in the middle of the workload.

A replacement's own instance tags are empty, so the tag-driven paths (spawn:command for sweeps, job-array env) mostly do nothing. Only the embedded command runs.

Possible fix: have the bootstrap run the same replacement check before it launches the workload, for example a spored is-spot-replacement subcommand that exits non-zero on a confirmed replacement. The bootstrap would skip the workload on that exit code and run it on anything else (fail open, same as today).

Not verified live. It depends on cloud-init running user data on the replacement, which is expected for a new instance id but also unverified (see #995).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions