Skip to content

task run: confirm on_complete=terminate fires (spored version + completion-file) — TTL is currently the only guaranteed teardown #406

Closed

Description

@scttfrdmn

Context

Found during the spawn#386 increment-2 smoke test (real spawn task run --wait, t3a.small, TTL 20m). The task ran end-to-end correctly — staged, ran, wrote the durable completion.json (exit 0) — but the instance did not self-terminate promptly on completion. It was still running ~5 minutes after completion.json was written; I terminated it manually. The 20-minute TTL is the guaranteed backstop and would have caught it.

What we know

  • The launch stamped the right tags: spawn:on-complete=terminate, spawn:ttl=20m, spawn:ttl-deadline, but no spawn:completion-file tag.
  • pkg/provider/ec2.go:612-614 already defaults CompletionFile to /tmp/SPAWN_COMPLETE when on-complete is set and no completion-file tag exists — so spored should have watched the file the wrapper wrote.
  • The generated task wrapper (pkg/taskproto/wrapper.go) does write /tmp/SPAWN_COMPLETE with {"status":"completed",...}.
  • The monitor loop checks completion every ~1 minute (pkg/agent/agent.go:297), so ~5 min = ~5 ticks with no teardown.
  • Leading suspicion: the running spored was the AMI-baked v0.38.1, not the freshly-downloaded release binary (spawn status reported 0.38.1 → 0.81.0). If the bootstrap's spored download no-op'd or an older spored ran, its completion handling may predate the reliable path. Needs confirmation.

To investigate / fix

  1. Confirm which spored actually runs on a task run instance (bootstrap download vs AMI-baked), and that it's current.
  2. Confirm on_complete=terminate fires from the /tmp/SPAWN_COMPLETE the wrapper writes, on a current-spored instance (SSH/SSM in, check /var/log/spored.log for "Completion signal detected").
  3. If the completion-file default isn't reliably applied on the headless/task path, have spawn task run set the spawn:completion-file tag explicitly (or set LaunchConfig.CompletionFile) so it's not left to a provider-side default.

Severity

Not a correctness bug in the durable-record contract (that works). But teardown-on-completion is the ergonomic win; until it's confirmed, the TTL is the only guaranteed teardown — task run always sets one, so there is no leak risk, just a delay to the TTL deadline. Tracked as a follow-up to spawn#386 increment 2 (PRs #404/#405).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions