mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-12 17:52:48 +03:00
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:
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user