HydraIssues

hydrabody: stream session stays active when Moonlight is killed (no stream/ended hook fired)
closed bug Project: hydrabody Reporter: 19 May 2026 12:54

Description

When Moonlight is killed (SIGKILL via stopMoonlightStream) rather than cleanly disconnecting, Sunshine does not fire POST /api/v1/stream/ended. hydrabody session registry stays active indefinitely.

Observed 2026-05-19 on fluffy-dumpling-87 bringup: stream stopped from cheeky-cactus-86, Moonlight killed, 12 min later fluffy still showed stream_status=streaming / stream_count=1. Next discovery call ranked fluffy as busy and routed to cosmic-pretzel-98 instead.

Manual workaround: POST /api/v1/stream/ended {"app":""} on the body.


Additional finding (2026-05-19): hydrabody's grace-period cleanup DID fire (cleanup record: 'grace period expired' at 12:52:38) but Rupelmonde.exe survived it and kept running. The experience was still audibly playing ~6 minutes after session cleared — killExperienceProcesses was not finding the process because PID tracking had failed (pid=0 in session metadata).


FIXED in hydrabody v2.0.43 (2026-05-19):

Added stale session watchdog (pkg/provider/stale_session_watchdog_windows.go): every tick, if stream_status is 'streaming' but no ESTABLISHED TCP connection exists on port 47998 (Sunshine RTSP control) for more than 2 minutes, OnStreamEnded is called for all active sessions. The lifecycle manager then kills the process after the 30s grace period. Total recovery time: ~2-3 minutes after client disconnect.

This is simpler and more reliable than polling Sunshine's sessions list API (the originally proposed fix). Deployed to all body nodes 2026-05-19.