log when a frame slot was overwritten before it was read

A lapped read and a missing segment ended up as the same debug line at every caller, so there was no way to tell a slow reader from a missing frame.
This commit is contained in:
Josh Hawkins
2026-10-11 23:01:33 -05:00
parent d807bafd49
commit 867dd95ac6
2 changed files with 10 additions and 3 deletions
@@ -217,13 +217,19 @@ class TestSharedMemoryFrameManagerFrameTimes(unittest.TestCase):
segments = _segments(cam_frame0=2_500, cam_frame_times=8 * 2)
np.frombuffer(segments["cam_frame_times"].buf, dtype=np.float64)[0] = 200.0
with patch(
"frigate.util.image.UntrackedSharedMemory",
side_effect=_open_from(segments),
with (
patch(
"frigate.util.image.UntrackedSharedMemory",
side_effect=_open_from(segments),
),
self.assertLogs("frigate.util.image", "DEBUG") as logs,
):
arr = manager.get("cam_frame0", (50, 50), frame_time=100.25)
self.assertIsNone(arr)
self.assertIn(
"cam_frame0 no longer holds the frame from 100.25", logs.output[0]
)
def test_get_returns_none_when_slot_index_is_beyond_ledger(self) -> None:
manager = SharedMemoryFrameManager()
+1
View File
@@ -1108,6 +1108,7 @@ class SharedMemoryFrameManager(FrameManager):
self.close(f"{name.rpartition('_frame')[0]}_frame_times")
if not self._holds(name, frame_time):
logger.debug("%s no longer holds the frame from %s", name, frame_time)
return None
try: