Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log message when discarding recording segments in cache #3439

Merged

Conversation

deviant77
Copy link
Contributor

Currently Frigate silently discards recording segments in cache if there's more than "keep_count" for a camera.
This was happening on my system because it had a high load and was being slow to process the segments (copy segment and commit to the database).

I noticed when watching recordings that there was missing segments of video at random times, but I had no idea why because the segments were being discarded silently (even when logging set to debug).

This PR adds a warning log entry when discarding segments (in the same way as discarding corrupted segments) to aid troubleshooting.

Currently Frigate silently discards recording segments in cache if there's more than "keep_count" for a camera, which can happen on high load/busy/slow systems.
This results in recording segments being lost with no apparent cause in the logs (even when set to debug).
This PR adds a warning log entry when discarding segments, in the same way as discarding corrupted segments
@NickM-27
Copy link
Sponsor Collaborator

NickM-27 commented Jul 7, 2022

Would probably be good to have a log message as well saying something like "deleting cached recording segments as {number of files} > {max_keep}" or something so it's clear why it's happening

@deviant77
Copy link
Contributor Author

Would probably be good to have a log message as well saying something like "deleting cached recording segments as {number of files} > {max_keep}" or something so it's clear why it's happening

Good idea. I have done that.
Here's a sample of what the log output will look like:

[2022-07-18 23:21:52] frigate.record                 WARNING : Too many recording segments in cache for Kitchen. Keeping the 5 most recent segments out of 9, discarding the rest...
[2022-07-18 23:21:52] frigate.record                 WARNING : Discarding a recording segment: /tmp/cache/Kitchen-20220718232017.mp4
[2022-07-18 23:21:52] frigate.record                 WARNING : Discarding a recording segment: /tmp/cache/Kitchen-20220718232025.mp4
[2022-07-18 23:21:52] frigate.record                 WARNING : Discarding a recording segment: /tmp/cache/Kitchen-20220718232037.mp4
[2022-07-18 23:21:52] frigate.record                 WARNING : Discarding a recording segment: /tmp/cache/Kitchen-20220718232045.mp4

@blakeblackshear blakeblackshear merged commit ed1897d into blakeblackshear:release-0.11.0 Jul 19, 2022
@deviant77 deviant77 deleted the discard-cache-logging branch July 29, 2022 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants