Dispatcharr/apps/proxy/live_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
..
input 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
output fix(channel management): Implement channel initialization grace period handling to ensure proper state transitions during live stream startup. Channels now honor the configured grace period for buffer filling, promoting to active state when conditions are met. Updated related tests and documentation for clarity. (Fixes #1380) 2026-06-25 14:24:30 -05:00
services fix(proxy): reap ghost channel sessions stuck in initializing 2026-07-11 23:08:17 -04:00
tests fix(proxy): reap ghost channel sessions stuck in initializing 2026-07-11 23:08:17 -04:00
__init__.py
apps.py
channel_status.py feat(timeshift): add catch-up playback, stats, and admin APIs 2026-07-11 17:14:31 +00:00
client_manager.py feat(timeshift): add catch-up playback, stats, and admin APIs 2026-07-11 17:14:31 +00:00
config_helper.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
constants.py feat(timeshift): add catch-up playback, stats, and admin APIs 2026-07-11 17:14:31 +00:00
redis_keys.py
server.py fix(proxy): reap ghost channel sessions stuck in initializing 2026-07-11 23:08:17 -04:00
url_utils.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
urls.py
utils.py
views.py fix(proxy): reap ghost channel sessions stuck in initializing 2026-07-11 23:08:17 -04:00