Skip to content

A bootstrap failure after spored starts but before --command launches writes no completion record; the instance bills to TTL #1484

Closed

Description

@scttfrdmn

Summary

A bootstrap failure after spored has started but before the --command subshell is launched writes no completion record, so --on-complete never fires and the instance bills until its TTL or idle timeout. This is the same class of gap as #1483, in the non-MPI bootstrap (pkg/launcher/bootstrap.go). Found while fixing #1483; not fixed there because the fix needs a marker in the published body (see below).

Where

  • SPAWN_SPORED_UP=1 is set at pkg/launcher/bootstrap.go:1019 (main at edd0ae9), right after systemctl start spored.
  • The --command subshell, which writes the completion record on success, on failure and on a failed gate, is launched at about line 1354.
  • Between them, about 330 lines run under the bootstrap's set -e: useradd, the sudoers write, the base64 -d of the SSH key, chown, the session-timeout/sshd configuration, the job-array and hostname setup, and the sweep block.
  • spawn_exit_guard (in fatalRetireFunc, part of the per-launch prefix) is the only EXIT handler. Once SPAWN_SPORED_UP=1 it returns 0, which is right for TTL enforcement (spored is running), but nothing records that the requested command never started.

Evidence (local, no AWS)

The fatalRetireFunc text from bootstrap.go, run under set -e, then SPAWN_SPORED_UP=1 and a failing stand-in for one of those steps:

spored up
exit=9
ls: SPAWN_COMPLETE: No such file or directory

There is no retire, which is correct, and no completion record. The command block is never reached.

On an MPI member the same window comes before the MPI fragment, so #1483's exit trap (installed at the top of the MPI user data) does not cover it either.

Cost angle

spored enforces the TTL and idle timeout, so this is bounded. But a --command ... --on-complete terminate launch that fails here runs until one of them fires. It is the cost leak --on-complete exists to prevent.

Possible fix

In spawn_exit_guard (prefix, not the published body): when spored is up, rc != 0, a command was requested, and the command has not been launched, write {"status": "failed", "exit_code": rc, "source": "bootstrap"} to $SPAWN_CMD_COMPLETION_FILE.

"Launched" needs a reliable marker. Today the nearest is /tmp/spawn-command.sh, which is written just before the subshell, but an image can carry a stale copy. A marker variable set by the body right after ( ... ) & would be exact, but it changes the published body. "A command was requested" is -s /etc/spawn/command for embedded commands. The tag-delivered sweep commands are only known after the describe-tags call, so those need the body's help too.

Activity

  1. added
    bug
    area:lifecycle
    spend-safety
    on Nov 2, 2026
  2. added this to the v0.155.0 milestone on Nov 2, 2026
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

    area:lifecyclebugspend-safety

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions