SergeantPanda
391c3412d2
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:31:21 -05:00
SergeantPanda
fd93c0dc3d
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 )
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Frontend Tests / test (push) Has been cancelled
2026-06-25 14:24:30 -05:00
SergeantPanda
c68249c314
fix: replace fork()-based subprocess with posix_spawn at all uWSGI spawn sites
...
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Frontend Tests / test (push) Waiting to run
Base Image Build / prepare (push) Has been cancelled
Base Image Build / docker (amd64, ubuntu-24.04) (push) Has been cancelled
Base Image Build / docker (arm64, ubuntu-24.04-arm) (push) Has been cancelled
Base Image Build / create-manifest (push) Has been cancelled
gevent registers a pthread_atfork handler that never yields. Any
subprocess.Popen/run call in a uWSGI greenlet hangs indefinitely at
fork() before the child process even starts.
- dispatcharr/gevent_patch.py: new; monkey.patch_all() + psycogreen,
loaded via uWSGI import= in all four ini files
- live_proxy/input/manager.py: posix_spawn + _SpawnedProcess; removed
dead forwarder code
- live_proxy/input/http_streamer.py: O_NONBLOCK on relay pipe + EAGAIN
retry (blocking write to a full pipe stalls the gevent hub)
- live_proxy/utils.py: new posix_spawn_proc() helper with O_NONBLOCK
stdin, shared by both output managers
- live_proxy/output/fmp4/manager.py, output/profile/manager.py:
posix_spawn_proc(); _write_all() treats EAGAIN (None) as cooperative
select.select wait instead of fatal error
- core/views.py (stream_view): posix_spawn; fixed pre-existing bug
where return StreamingHttpResponse(...) was indented inside
stream_generator, making the success path always return None
- connect/handlers/script.py: _posix_run() with posix_spawn +
cooperative select reads + non-blocking waitpid; fixes deadlock when
a script integration fires on a uWSGI-context event (client_connect
fires in the live proxy, not Celery)
2026-05-15 16:45:09 -05:00
SergeantPanda
92f98a24c7
fix: increase ghost client multiplier to improve client detection timing
2026-03-15 20:45:55 -05:00
None
40d0bc9567
fix: cap keepalive mode duration to prevent indefinite client hold
...
- Add MAX_KEEPALIVE_DURATION = 300s to TSConfig
- Track keepalive_start_time in _stream_data_generator; disconnect after cap is exceeded with a warning log
- Reset timer on real data so independent stalls don't accumulate
- Fix pre-existing test helper missing throttle attributes in NonOwnerWorkerKeepaliveTests
2026-03-15 14:22:57 -05:00
SergeantPanda
78aa8cf353
Enhancement: Change default new client behind seconds from 2 to 5 for stability.
2026-03-05 15:36:12 -06:00
SergeantPanda
fc75a68195
Enhancement: new clients joining an active channel are now positioned a configurable number of seconds behind live rather than a fixed chunk count. The start position is determined by wall-clock chunk receive time (stored as a Redis sorted set alongside the buffer), so the buffer depth is consistent in seconds regardless of stream bitrate. Setting the value to 0 starts clients at live with no buffer. Defaults to 2 seconds. Existing chunk-count gating for the first client connecting to a channel is unchanged. The setting is exposed in Settings → Proxy as "New Client Buffer (seconds)".
2026-03-03 18:12:32 -06:00
SergeantPanda
6715bc7c5c
Enhancement: Update TTL settings for client records and implement periodic refresh during active streaming
2025-10-31 11:53:16 -05:00
SergeantPanda
9b2ebf169b
Better database connection cleanup.
2025-10-16 14:22:19 -05:00
SergeantPanda
ed065f718d
Enhancement: Implement caching for proxy settings to improve performance and reduce database load. Also, ensure database connections are closed after use in both config and stream manager.
2025-10-14 13:44:28 -05:00
SergeantPanda
2284d47f9f
If provider is slow but responsive, don't get locked up.
2025-07-08 17:10:55 -05:00
SergeantPanda
d6605e7119
Add timeout for chunks.
2025-07-08 15:57:11 -05:00
SergeantPanda
c4a6b1469e
Change to JSON settings
2025-06-13 14:36:08 -05:00
SergeantPanda
b4ae6911c9
Pull settings from database
2025-06-12 15:42:26 -05:00
SergeantPanda
a2c7fc3046
[New feature]
...
Switch streams when buffering is detected.
2025-06-10 17:43:37 -05:00
SergeantPanda
898224dc72
Fix potential issue during stream switches.
2025-05-05 17:02:28 -05:00
SergeantPanda
60fd5afd94
More robust stream switches. Has client wait if in switching state.
2025-04-14 21:03:33 -05:00
SergeantPanda
07485f87a3
Add stream health recovery and reconnection logic
2025-04-10 10:14:22 -05:00
SergeantPanda
6ccc2b9a6d
Enhance stream retrieval process with error handling and retry logic
...
- Updated `get_stream` method to return error reasons for better debugging.
- Improved `generate_stream_url` to handle errors and log specific issues.
- Implemented retry mechanism in `stream_ts` view for obtaining streams with exponential backoff.
- Added new configuration options for connection timeout and retry intervals.
2025-04-10 08:38:53 -05:00
SergeantPanda
d6a452548c
Automatic stream switching is working.
2025-03-20 15:28:12 -05:00
SergeantPanda
a4c69710b7
Stream switching is working for both proxy and transcode
2025-03-15 17:23:06 -05:00
SergeantPanda
f69dfed3e8
Require clients to wait until initial_behind_chunks is reached.
2025-03-15 15:32:19 -05:00
SergeantPanda
8f8b4ef371
More refractoring and slight modifications.
2025-03-15 14:35:34 -05:00
SergeantPanda
69f4ceb137
Streaming is working fairly well now.
2025-03-13 15:56:04 -05:00
SergeantPanda
d00aa3444e
Switched back to http connections instead of socket.
2025-03-13 13:15:48 -05:00
SergeantPanda
1284567409
Client cleanup is working much better now.
2025-03-11 22:07:19 -05:00
SergeantPanda
fa5fc86c99
Disconnects are working better now.
2025-03-10 17:56:09 -05:00
SergeantPanda
ed30b8608d
Most of the functionality is there now.
2025-03-09 20:13:52 -05:00
SergeantPanda
5563bd0d5e
Switched to owner staying as initializer.
2025-03-09 19:37:15 -05:00
SergeantPanda
47c6346a6b
When last client disconnects and the channel.
2025-03-09 16:23:50 -05:00
SergeantPanda
e22e06aa61
Set ttl to 60 seconds
2025-03-09 15:56:08 -05:00
SergeantPanda
07cc8c644b
Updated config
2025-03-09 15:13:22 -05:00
SergeantPanda
2509553095
Streaming is working very well.
2025-03-09 15:10:56 -05:00
SergeantPanda
8e624b9d1a
Fixes clients disconnecting when reaching eof
2025-03-09 14:55:14 -05:00
SergeantPanda
3b3e5f7b52
Waits for api to return status until stream is running.
2025-03-04 12:03:09 -06:00
SergeantPanda
85e41d5def
Initial integration.
2025-03-03 18:40:30 -06:00