Dispatcharr/apps/proxy/live_proxy/tests
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
..
__init__.py tests: Move tests to under tests folder. 2026-07-07 18:51:35 +00:00
test_alternate_stream_order.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
test_failover_retry_window.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
test_ghost_session_cleanup.py fix(proxy): reap ghost channel sessions stuck in initializing 2026-07-11 23:08:17 -04:00
test_live_db_cleanup.py Enhancement: Prevent 500 errors in live proxy preview when joining active channels on non-owner workers by ensuring proper client registration and cleanup. Update changelog to reflect this fix. 2026-07-06 21:05:09 -05:00
test_proxy_settings.py refactor(proxy): Add new client connect grace period setting and update channel initialization grace period defaults. The channel_client_wait_period is introduced to manage channel lifetimes before client connections, while the channel_init_grace_period default is increased to improve failover handling. 2026-06-28 11:34:44 -05:00
test_stream_ts_client_registration.py Enhancement: Prevent 500 errors in live proxy preview when joining active channels on non-owner workers by ensuring proper client registration and cleanup. Update changelog to reflect this fix. 2026-07-06 21:05:09 -05:00
test_vlc_failover.py Enhancement: Implement live proxy failover for VLC stream profile, ensuring proper handling of upstream URL failures. Update changelog to reflect changes in stream management and VLC profile parameters. 2026-07-06 16:45:56 -05:00