Dispatcharr/apps/proxy
Josh Becker efad028be1
fix(proxy): reap ghost channel sessions stuck in initializing
A channel initialization that died between the early metadata write and
stream manager creation left immortal 'initializing' metadata: no owner
lock, no URL, no TTL. Every future play request attached to the dead
session and got 'Error: Connection stalled'; failover was never tried;
the orphan sweep never reaped it because it only checked whether the
owner *worker* heartbeat was alive, not whether any worker actually
held the channel ownership lock. The M3U profile connection slot also
leaked (#947).

- Detect ghost sessions (pre-active state, no ownership lock, past the
  init grace period) on play requests and reinitialize instead of
  attaching; check_if_channel_exists() now cleans them up too.
- Mark failed initializations as 'error' (terminal) instead of leaving
  'initializing' behind, and give early init metadata a TTL so any
  missed failure path expires on its own.
- Extend the 30s orphan sweep to reap pre-active channels with no
  ownership lock and no clients after 2x the init grace period, even
  when the owning worker is still alive.
- Cleaning a ghost releases the leaked M3U profile connection slot.

Fixes the ghost-session variant of #669/#695 and the init-failure slot
leak of #947.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 23:08:17 -04:00
..
hls_proxy security: Hardened the HLS proxy change_stream endpoint by converting it from a plain Django view to a DRF @api_view with @permission_classes([IsAdmin]), ensuring the endpoint actually enforces admin-only access. The previous decorator arrangement (@csrf_exempt + @permission_classes) had no effect on a plain Django view. 2026-04-09 19:58:40 -05:00
live_proxy fix(proxy): reap ghost channel sessions stuck in initializing 2026-07-11 23:08:17 -04:00
management/commands Enhancement: Initial fmp4 support and major ts_proxy refactor 2026-05-08 17:46:47 -05:00
tests fix(proxy): enhance stream switching logic and error handling 2026-07-11 18:21:48 +00:00
vod_proxy Update tests and changelog. 2026-07-02 14:03:29 -05:00
__init__.py Initial integration. 2025-03-03 18:40:30 -06:00
apps.py Enhancement: Initial fmp4 support and major ts_proxy refactor 2026-05-08 17:46:47 -05:00
config.py Enhancement: Improve live proxy failover logic by resetting connection retries after a specified period of stability and ensuring backup streams are rotated in channel order. Update changelog to reflect these changes. 2026-07-06 19:11:32 -05:00
signals.py Enhancement: Initial fmp4 support and major ts_proxy refactor 2026-05-08 17:46:47 -05:00
stats_views.py feat(timeshift): add catch-up playback, stats, and admin APIs 2026-07-11 17:14:31 +00:00
tasks.py feat(timeshift): add catch-up playback, stats, and admin APIs 2026-07-11 17:14:31 +00:00
urls.py feat(timeshift): add catch-up playback, stats, and admin APIs 2026-07-11 17:14:31 +00:00
utils.py feat(timeshift): add catch-up playback, stats, and admin APIs 2026-07-11 17:14:31 +00:00
views.py Initial integration. 2025-03-03 18:40:30 -06:00