mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
After an RTSP read timeout the stream cleanup killed the stalled ffmpeg and then awaited process.wait() unbounded. A SIGKILLed ffmpeg stuck in uninterruptible I/O on a dead RTSP socket can take arbitrarily long to be reaped, so the fan-out stream coroutine sat parked in that wait (12 hours in the reported case) while every new viewer attached to the stalled broadcaster and received no frames. Bound the post-kill wait to 2s in all three places it existed: the stream generator's _terminate_ffmpeg (the reported hang), the camera stop endpoint (which would hang the recovery request itself; now uses the shared helper instead of an inline copy), and the orphan-cleanup janitor (whose hang would disable the safety net). On timeout the zombie is abandoned; the janitor's /proc scan reaps it next pass and the stream proceeds to its normal reconnect.