Repository navigation
Description
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=1is set atpkg/launcher/bootstrap.go:1019(main at edd0ae9), right aftersystemctl start spored.- The
--commandsubshell, 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, thebase64 -dof the SSH key,chown, the session-timeout/sshd configuration, the job-array and hostname setup, and the sweep block. spawn_exit_guard(infatalRetireFunc, part of the per-launch prefix) is the only EXIT handler. OnceSPAWN_SPORED_UP=1it 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
test(bootstrap): gate the post-spored fail-closed record (#1484); CHA…
fix(bootstrap): record a failed completion when the bootstrap fails a…