From 10179b5cfbb70f335e55178c96c326e79fb3fd64 Mon Sep 17 00:00:00 2001 From: Bazyl Horsey <31446064+bazylhorsey@users.noreply.github.com> Date: Fri, 21 Aug 2026 16:37:24 -0500 Subject: [PATCH] fix(video): release shm handle when a captured frame is skipped --- frigate/video/ffmpeg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frigate/video/ffmpeg.py b/frigate/video/ffmpeg.py index 24b7805333..d1a7003630 100644 --- a/frigate/video/ffmpeg.py +++ b/frigate/video/ffmpeg.py @@ -99,10 +99,14 @@ def capture_frames( try: # add to the queue frame_queue.put((frame_name, current_frame.value), False) - frame_manager.close(frame_name) except queue.Full: # if the queue is full, skip this frame skipped_eps.update() + finally: + # release our handle either way. on the skip path the frame is + # never handed to a consumer, so nothing else will close it and + # the mapping stays open until this ring slot comes back around. + frame_manager.close(frame_name) frame_index = 0 if frame_index == shm_frame_count - 1 else frame_index + 1 finally: