Skip to content

spored readiness via SSM SendCommand times out (3m) on AL2023/m8g though SSH is up → --command unusable #277

Closed

Description

@scttfrdmn

spored never becomes ready (SSM SendCommand times out at 3m) on m8g.4xlarge / AL2023, though SSH is up

What happened

spawn launch --command '...' on m8g.4xlarge (spot, AL2023 default AMI) consistently failed the spored readiness gate:

✅ Waiting for SSH (120.0s)
instance i-… launched but spored never came up: spored did not become ready within 3m0s:
  ssm send-command: operation error SSM: SendCommand, context deadline exceeded

Reproduced on 2 separate launches. SSH itself connects fine within ~120s; it is specifically the SSM SendCommand path (how --command is delivered and how spored readiness is probed) that times out.

Environment

spawn v0.68.1, us-west-2 (Graviton m8g.4xlarge, AL2023). NOTE: this was initially entangled with the region bug (#276 — box was actually in us-west-1 while SSM may have targeted elsewhere); after pinning region to us-west-2 the box launched correctly but I moved to --require-spored=false + SSH so I did not re-confirm whether SSM SendCommand succeeds once region is correct. Flagging in case the SSM timeout is independent of the region issue.

Impact

spawn launch --command (SSM-delivered) is unusable when this triggers — the box either fails the gate (and without --terminate-on-error, leaks with no TTL) or the command never runs. The SSH path (spawn connect -- '...') works and is the reliable alternative on this account.

Ask

  1. Confirm whether SSM SendCommand readiness works on AL2023/m8g once --region resolves correctly (may be a dup of spawn launch --region ignored; ambient AWS_REGION/resolution wins → instance in wrong region #276's symptom).
  2. If SSM genuinely lags on AL2023 Graviton: raise the 3m readiness timeout, or fall back to the SSH command-delivery path, or make --require-spored=false + SSH the documented pattern for --command.

Workaround

spawn launch --require-spored=false (bare) + spawn connect <name> -- '<cmd>' (SSH delivery). This is the pattern the fieldwork tutorials already use for tutorials 02–04.

Activity

  1. scttfrdmn commented on Jul 8, 2026

    @scttfrdmn
    ContributorAuthor

    Follow-up: with region pinned correctly (us-west-2), BOTH launch paths are still blocked

    Ruled out the region confound (#276) by pinning AWS_REGION=AWS_DEFAULT_REGION=us-west-2. Boxes then correctly launch in us-west-2. But I still can't get a workload to run on m8g.4xlarge spot / AL2023:

    Path A — spored on (default): spawn launch --command '...' → spored did not become ready within 3m0s: ssm send-command … context deadline exceeded. So SSM readiness genuinely fails on AL2023/m8g independent of region.

    Path B — spored off: spawn launch --require-spored=false (bare) + spawn connect <name> -- '<cmd>' over SSH. The box launches and SSH works, the job starts — but the instance is terminated within ~100s with Client.UserInitiatedShutdown (NOT spot reclaim — the spot request stays active/fulfilled). This happened even when the job was detached with setsid … < /dev/null & so it outlives the SSH session. So it's not session-exit; spawn's lifecycle appears to terminate a --require-spored=false --on-complete terminate box early — plausibly because with spored disabled there's no workload signal, so completion/idle detection mis-fires.

    The bind

    • spored ON → readiness gate times out, box unusable (this issue's original report).
    • spored OFF → lifecycle terminates the box ~immediately, before the workload runs.

    Either way, a spot m8g/AL2023 box can't run a nohup/setsid workload here.

    Questions

    1. Is SSM SendCommand expected to work on AL2023 Graviton spot? If the base AMI's SSM agent isn't registering, that's the root of Path A.
    2. With --require-spored=false, what drives --on-complete terminate / idle? If there's no spored, is idle measured by SSH sessions? A detached job leaves no session, so the box would look idle instantly — which would explain the ~100s termination. If so, --require-spored=false + --on-complete terminate + a backgrounded job is a footgun; docs or a guard would help.

    Env

    spawn v0.68.1, us-west-2b, m8g.4xlarge spot, AL2023 default AMI, AWS_PROFILE=aws. Instances (all terminated, no leak): i-0bc72acb0878eaf7e (Path B), i-0711a5a91418f33ed (Path B, session-exit variant), i-06ea66e97a2578d29 / i-070eb9823e4e9e4de (Path A).

  2. scttfrdmn commented on Jul 8, 2026

    @scttfrdmn
    ContributorAuthor

    Correction — the "terminates early" half of this report was likely MY bug, not spawn's

    I checked CloudTrail on the terminated boxes. The TerminateInstances call came from:

    • principal: assumed-role/spawn-instance-7c61d839/i-0bc72acb… (the instance's OWN role)
    • sourceIP: the box's own public IP
    • userAgent: aws-sdk-go-v2 … os/linux GOARCH/arm64

    i.e. the box terminated ITSELF via spored — this is --on-complete terminate working as designed, triggered by a completion signal, NOT spot reclaim and NOT an external reaper. My run script (01_loam_run.sh) ends with touch /tmp/SPAWN_COMPLETE, which is exactly what spored watches for. So the ~100s self-termination is most plausibly my workload signaling completion (or my script erroring out under set -e during the on-box pip install loam), not spawn misbehaving.

    Retracting the "--require-spored=false + --on-complete terminate terminates the box early" claim — I don't have evidence spawn misfired; the simpler explanation is my own script/lifecycle usage. Apologies for the noise.

    What remains genuinely worth your input (the original report): does SSM SendCommand readiness (Path A / --command) actually work on AL2023 Graviton m8g spot? That timeout is the part I still can't explain, and it's independent of the self-termination. If SSM-on-AL2023-Graviton is expected to work, I'm happy to gather agent logs. #276 (region flag ignored) stands as filed.

  3. scttfrdmn commented on Jul 8, 2026

    @scttfrdmn
    ContributorAuthor

    Symptom A fixed (PR #279, merged to main)

    The spored-readiness gate no longer fails on a fresh AL2023/Graviton instance. verifySporedReady now waits for the SSM agent to register (PingStatus=Online via WaitForSSMOnline) before sending spored status — previously it fired SendCommand immediately, so on a just-booted spot box every send failed until the 3m gate timed out ("context deadline exceeded"). It also fails fast (ErrSSMUnreachable, seconds) if the instance has no IAM instance profile, since the agent could then never register. Gate budget raised 3m → 5m for Graviton registration latency. Substrate-backed tests cover both the online-then-succeed and fast-fail paths.

    Symptom B still open

    The --require-spored=false box terminating ~100s with Client.UserInitiatedShutdown is not addressed — it needs a gated live repro to isolate the mechanism (default idle is 1h and checkCompletion no-ops without a completion file, so the obvious suspects are ruled out). Leaving this issue open for Symptom B.

    (Also flagging: the attachment in the earlier comment is from an unknown account with no stated relevance — I have not opened it and recommend it be removed.)

  4. scttfrdmn commented on Jul 8, 2026

    @scttfrdmn
    ContributorAuthor

    Symptom B — could NOT reproduce (live, Graviton/AL2023)

    Ran a live repro of the exact reported Path B sequence on a matching-arch box (t4g.small spot / AL2023 / us-east-1 / v0.68.1 — Graviton like m8g, cheaper):

    1. spawn launch smk277b --instance-type t4g.small --spot --require-spored=false --on-complete terminate --ttl 1h -y
    2. spawn connect smk277b -- 'setsid bash -c "sleep 600" < /dev/null > /tmp/job.log 2>&1 & …' (detached job that outlives the SSH session)

    The instance stayed running throughout — 4 min after the bare launch, then another 2.5 min after the connect+detached-job step. No early Client.UserInitiatedShutdown.

    What the live box showed (via SSM)

    Config: TTL=1h0m0s, IdleTimeout=0s, Hibernate=false
    On complete:  terminate (watching)      # watching /tmp/SPAWN_COMPLETE, which never appears
    
    • --ttl 1h correctly disables the default idle-timeout (they're mutually exclusive), so idle never fires. (Even when idle does fire, it only stops — never terminates — so idle can't explain a terminate anyway.)
    • on-complete terminate is armed but only acts when /tmp/SPAWN_COMPLETE exists. Confirmed in code: neither the bootstrap (bare launch, no --command) nor spawn connect -- <cmd> ever touches that file. checkCompletion no-ops without it.

    Assessment

    On this account/arch, a --require-spored=false --on-complete terminate box does not self-terminate early. The original report noted Path B was entangled with the region bug (#276, now fixed) and used m8g.4xlarge specifically. The ~100s Client.UserInitiatedShutdown with the spot request staying active is most consistent with an out-of-band terminate (something/someone issuing TerminateInstances) or an m8g/account-specific interaction I can't reproduce here — not a general spored lifecycle defect in the --require-spored=false path.

    Ask to move forward

    If Symptom B recurs, the decisive capture would be, on the affected box before it dies:

    • sudo journalctl -u spored --no-pager (does spored log terminate? with what reason?)
    • CloudTrail TerminateInstances event for the instance id → the userIdentity shows who issued it (spored's instance role vs. a human/other principal vs. an ASG/reaper).

    Without a spored terminate log line, this points away from spored. Suggest keeping open pending that capture, or closing as not-reproducible. Symptom A is fixed (PR #279).

  5. scttfrdmn commented on Jul 9, 2026

    @scttfrdmn
    ContributorAuthor

    Confirming Symptom B is NOT a spored defect — the CloudTrail capture you asked for

    Agree with closing. I captured the decisive evidence on the original m8g.4xlarge boxes, and it matches your not-reproducible finding exactly. The TerminateInstances call on the box that died at ~100s:

    • userIdentity.arn: assumed-role/spawn-instance-7c61d839/i-0bc72acb0878eaf7e (the instance's OWN role; session name = its own instance id)
    • sourceIPAddress: the box's own public IP
    • userAgent: aws-sdk-go-v2 … os/linux GOARCH/arm64 (a Go program on the box)

    So the box terminated itself — this is --on-complete terminate firing, not an external reaper and not spot reclaim (spot request stayed active). My run script ends with touch /tmp/SPAWN_COMPLETE, which is precisely the signal checkCompletion watches for; combined with an early script exit under set -e (the on-box pip install was failing at that point), the completion path fired as designed. Entirely my own usage, compounded by the #276 region bug putting the box where I wasn't looking.

    Symptom A (SSM readiness, #279) and #276 both confirmed fixed in v0.69.0 — thanks for the fast turnaround. Nothing further needed here.

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