Repository navigation
Conversation
When the camera behind go2rtc drops and go2rtc reconnects within a few seconds, the RTSP consumers keep their connection but the RTP timestamps jump. The recorder ffmpeg then stops writing the segment (it buffers in memory until it exits) and the motion ffmpeg stops printing scene scores. Neither process exits, so the exit-based restart never kicks in and recording/motion detection stay dead until the container restarts. Supervisor gets an optional stallMs: when a running process has not reported progress() for that long, it is sent SIGINT (SIGKILL after 5 s) and the normal exit path restarts it. - motion: every scene score line counts as progress (stallMs 60 s) - recorder: growth of the segment being written, checked by the existing 20 s scan, counts as progress (stallMs 90 s) Seen with a camera whose RTSP server restarts every few minutes: the current segment stayed at 48 bytes and no motion events were raised after a reconnect; SIGINT flushed the buffered segment and both recovered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the camera behind go2rtc drops and go2rtc reconnects within a few seconds (in my case the camera's RTSP server restarts every few minutes), the RTSP consumers stay connected but the RTP timestamps jump. After that:
lavfi.scene_scorelines, so no motion events are raised.Neither process exits, so the exit-based restart in
Supervisornever runs. Recording and motion detection stay dead until the container restarts.Change
Supervisorgets an optionalstallMsand aprogress()method. If a running process has not reported progress forstallMs, it getsSIGINT(SIGKILLafter 5 s), and the normal exit path restarts it with the usual backoff.stallMsis 60 s, which leaves room for-skip_frame nokeybursts.doScanchecks it.stallMsis 90 s.test/proc.test.ts: a silent process is restarted,progress()keeps it running, and nothing changes withoutstallMs.Testing
bun testpasses 76 of 76, andtsc --noEmitis clean.SIGINTto a stalled recorder flushed the buffered segment (8.2 MB written at exit). Freezing the motion ffmpeg withSIGSTOPproducedno progress for 65s, restarting, and scene scores came back right after the restart.