HydraIssues

One slot API failure kills every slot: the sunshine-api watchdog judges all sessions against hardcoded port 47990
open bug Priority: high Project: Parent: #504 Reporter: 19 Oct 2026 15:47

Description

One slot's Sunshine API going unresponsive kills the sessions of EVERY slot and restarts every Sunshine on the body, including slots that are streaming to a visitor.

Observed

On cosmic, 2026-10-19, reported by the #844 session. Only slot 0 was targeted, with slot 0's own latest client already disconnected:

17:44:45  POST https://localhost:47990/api/apps/close   (slot 0 only)
          curl returned EMPTY after 5s
17:44:48  body watchdog "sunshine-api" kills fired
17:44:49  ...across all THREE registry records
          all 3 Sunshine providers restarted
          the LIVE slot 1 stream disappeared

No global force-stop was issued and no slot 1 kill was issued. Slot 1 was collateral.

Cause, from source

pkg/provider/sunshine.go:59

const sunshineBaseURL = "https://localhost:47990"

That is slot 0's web API port. provider.go:455 hands it to ONE client for the whole provider, and sunshine_health_windows.go then judges every session with it:

func (c *SunshineAPICheck) Check(session *sunshine.StreamSession) sunshine.WatchdogAction {
    _, err := c.client.ListApps()        // always 47990
    if err == nil { return ActionNone }
    return ActionKill                    // kills THIS session
}

Check is invoked once per session, but the question it asks is always "is slot 0's API answering". When slot 0 stops answering, every session's check fails and each returns ActionKill. Three sessions, three kills, and the provider restart that follows takes every instance down.

So a body with N slots has ONE point of failure for all N, and the slot most likely to be disturbed is slot 0, because it is the one whose API an operator or a tool can reach on the stock port.

Why this is more than a cleanup annoyance

Slot 1 was serving a stream when it was killed. On a venue body that is a visitor's screen going black because something touched a different kiosk's API. The watchdog exists to recover a hung slot; as written it converts one hung slot into three dead ones.

The same hardcoded URL is used for app listing and registration (sunshine.go:503 and :541), so those also only ever address slot 0. Per-slot apps.json is written on disk by RewriteAppsForSlot, which is why registration still works, but any future API-driven app change has the same blind spot.

What correct looks like

Each slot's health must be judged against ITS OWN port. Slot ports are already known: SlotSpec carries them and slot_report.go reports them to the cluster, with the web API at portBase + 1 (47990, 48090, 48190 for slots 0, 1, 2).

The watchdog needs the session's slot, so that Check queries that slot's web API and an ActionKill retires only that slot's session. A session whose slot cannot be determined should return ActionNone rather than ActionKill: not knowing which slot is unhealthy is not evidence that this one is, and the current default does the most destructive thing available.

Also worth fixing at the same time: ForceStop closes the running app through the same hardcoded 47990, so it only ever closes slot 0's app while clearing EVERY session record. That mismatch is how a stop can leave experiences running with no session to account for them, which is the #844-adjacent orphan problem.

Related

  • Three Mercator processes surviving with mis-tracked PIDs: fixed on hydrabody master (per-session PID claiming), separate defect.
  • The stray bare Sunshine from initSlots: fixed on hydrabody master, separate defect.
  • This issue is the remaining "one of everything" assumption on a multi-slot body: one API port, one app client, one force-stop target.

Session Context

Venue
cloud-seven