Repository navigation
Description
Root cause of the stall reproduced in the 2026-10-07 follow-up, and the keystone
of a four-defect chain. Found by a SIGQUIT goroutine dump on a watchdog.
The defect
cmd/launch_posthook.go:294:
func waitForSSHReady(ctx context.Context, host string, timeout time.Duration) {No return value. The timeout path and the success path are the same
statement:
if err == nil { _ = conn.Close(); return } // reachable
select {
case <-ctx.Done(): return // NOT reachable — identical return
case <-ticker.C:
}And the call site (cmd/launch_single.go:890-894) completes the progress step
unconditionally:
prog.Start("Waiting for SSH")
if waitForSSH && result.PublicIP != "" {
waitForSSHReady(ctx, result.PublicIP, 2*time.Minute) // cannot fail
}
prog.Complete("Waiting for SSH") // always ✅Observed in the repro:
02:50:49 ✅ Getting public IP (71ms)
02:52:49 ✅ Waiting for SSH (120.0s) <- exactly the timeout, still a ✅
120.0s to the tenth of a second is the deadline path's signature. SSH was never
reachable, and the launch reported that step as done.
Why this is the keystone, not a display bug
The launch then proceeds to steps that depend on SSH working. In the same
dump, the process is parked in registerDNS → exec.Cmd.CombinedOutput →
ssh, i.e. SSHing to the host it had just failed to reach, for minutes. See the
companion issue on registerDNS's retry budget.
Nothing in between catches it either: verifySporedReady (:905) passed, because
it uses SSM, which was working. So the instance had booted, spored was up, and
the one thing that was broken — the SSH path — was the one signal thrown away.
The full chain from the repro:
- launch auto-detects a region by TCP latency, ignoring AWS_REGION, the config default, and whether the instance type is even offered there #732 —
AWS_REGION=us-east-1ignored, instance auto-placed in us-west-1. - SSH never became reachable there (cause still open; the default VPC in
us-west-1 has an IGW andMapPublicIpOnLaunch=trueon all subnets, so it is
not a missing internet path, and the caller-IP SSH ingress rule left in
that region matches the controller's current public IP correctly — so neither
of the two obvious explanations holds). - This issue — the failure is unobservable and unreported.
verifySporedReadysucceeds over SSM, so no other gate notices.registerDNSSSHes to the unreachable host under a 4-minute retry deadline.- 24 of 32 progress step names are unregistered, so spawn's longest operations print nothing while they run #739 —
"Registering DNS"and"Verifying spored agent"are unregistered
progress step names, so steps 4–5 print nothing while they run.
Worst case: 2 min (this) + ~4 min (DNS retry) ≈ 6 minutes of silence after a
successful RunInstances, which is the originally-reported "hang". The reporter
killed the demo run at ~5m14s.
Suggested fix
- Return an error.
waitForSSHReadyshould returnerror, non-nil on
deadline, and the caller shouldprog.Error("Waiting for SSH", err)rather
thanComplete. - Use it as a gate. An unreachable SSH port means the SSH-dependent steps
cannot work.registerDNSshould be skipped with a clear message (the code
already has exactly this logic for--wait-for-ssh=falseat
cmd/launch_single.go:937— "we cannot and should not register a record
pointing at an instance whose reachability is unconfirmed". That reasoning
applies identically here; it just isn't reachable, because the failure is
invisible). - Say what to do. SSM worked, so the instance is usable:
SSH did not become reachable in 2m0s — the instance is up and reachable over SSM; check the security group's port-22 ingress, or use 'spawn connect' which falls back to SSM.That is a far better outcome than a ✅ followed by minutes
of silence. - Keep it non-fatal. The instance is fine and spored is enforcing its
lifecycle; this should degrade the launch, not fail it.
The guard result.PublicIP != "" is also worth a look — a launch with no public
IP skips the wait entirely and still prints ✅, which is the same false claim by a
different route.
Environment: spawn v0.123.0, c8g.xlarge, us-west-1 (auto-selected), AL2023.
Reproduced first try.
Activity
fix(launch): make the SSH-readiness result reportable, and gate DNS o…
fix(progress): append unknown steps instead of dropping them silently
fix(progress): append unknown steps instead of dropping them silently (…