[Support]: shm based frame storage can go out of date and brick the relevant camera until shm buffers are cleaned up #24048
Checklist
Describe the problem you are havingAfter an online system upgrade I started seeing error messages along the lines of After some debugging and instrumentation I have found that the following exception was being raised and that frigate was requesting It seems to me that the incorrect frame size of 1280x720 gets detected (or defaulted to) when my homelab boots up from scratch after a power outage and then next time frigate starts, camera resolution is correctly detected as 1280x960. Unfortunately, even after Steps to reproduce
Version0.17.2 (although I believe it should also affect dev) In which browser(s) are you experiencing the issue with?No response Frigate config fileaudio:
enabled: true
listen:
- bark
- fire_alarm
- scream
- speech
- yell
- roar
- growling
- whimper_dog
- crying
- car_alarm
- tire_squeal
auth:
enabled: false
birdseye:
enabled: false
cameras:
a:
ffmpeg:
input_args: preset-rtsp-restream
inputs:
- path: rtsp://127.0.0.1:8554/a_record
roles:
- record
- audio
- path: rtsp://127.0.0.1:8554/a_detect
roles:
- detect
output_args:
record: preset-record-generic-audio-copy
live:
height: 960
streams:
Live: a_record
motion:
contour_area: 60
threshold: 30
c:
audio:
enabled: false
detect:
enabled: false
ffmpeg:
input_args: preset-rtsp-restream
inputs:
- path: rtsp://127.0.0.1:8554/c
roles:
- record
live:
height: 960
streams:
Live: c
motion:
enabled: false
g:
ffmpeg:
input_args: preset-rtsp-restream
inputs:
- path: rtsp://127.0.0.1:8554/g_record
roles:
- record
- audio
- path: rtsp://127.0.0.1:8554/g_detect
roles:
- detect
output_args:
record: preset-record-generic-audio-copy
live:
height: 960
streams:
Live: g_record
motion:
contour_area: 60
mask: 0.276,0.034,0.264,0.135,0.471,0.148,0.764,0.22,0.781,0.171,0.682,0.112,0.551,0.058,0.422,0.044
threshold: 25
d:
ffmpeg:
input_args: preset-rtsp-restream
inputs:
- path: rtsp://127.0.0.1:8554/d_record
roles:
- record
- audio
- path: rtsp://127.0.0.1:8554/d_detect
roles:
- detect
output_args:
record: preset-record-generic-audio-copy
live:
height: 960
streams:
Live: d_record
motion:
contour_area: 60
threshold: 35
mb:
ffmpeg:
input_args: preset-rtsp-restream
inputs:
- path: rtsp://127.0.0.1:8554/mb_record
roles:
- record
- audio
- path: rtsp://127.0.0.1:8554/mb_detect
roles:
- detect
output_args:
record: preset-record-generic-audio-copy
live:
height: 960
streams:
Live: mb_record
motion:
contour_area: 50
mask: 0,0,0,0.488,0.862,0.105,0.88,0
threshold: 40
b:
ffmpeg:
input_args: preset-rtsp-restream
inputs:
- path: rtsp://127.0.0.1:8554/b_record
roles:
- record
- audio
- path: rtsp://127.0.0.1:8554/b_detect
roles:
- detect
output_args:
record: preset-record-generic-audio-copy
live:
height: 960
streams:
Live: b_record
motion:
contour_area: 50
threshold: 40
al:
ffmpeg:
input_args: preset-rtsp-restream
inputs:
- path: rtsp://127.0.0.1:8554/al_record
roles:
- record
- audio
- path: rtsp://127.0.0.1:8554/al_detect
roles:
- detect
output_args:
record: preset-record-generic-audio-copy
live:
height: 1280
streams:
Live: al_record
motion:
contour_area: 60
frame_height: 320
mask: 0,0,0.8,0.109,0.798,0.05,0.422,0
threshold: 30
t:
ffmpeg:
input_args: preset-rtsp-restream
inputs:
- path: rtsp://127.0.0.1:8554/t_record
roles:
- record
- audio
- path: rtsp://127.0.0.1:8554/t_detect
roles:
- detect
output_args:
record: preset-record-generic-audio-copy
live:
height: 960
streams:
Live: t_record
motion:
contour_area: 60
threshold: 25
database:
path: /var/lib/frigate/frigate.db
detect:
enabled: true
fps: 5
max_disappeared: 300
stationary:
interval: 15
threshold: 25
detectors:
ov:
device: GPU
type: openvino
ffmpeg:
hwaccel_args: preset-vaapi
path: /nix/store/8s3h27dpxqqbvb6by2v5c3lfj7vs8v8y-ffmpeg-headless-8.1.1-bin
go2rtc:
api:
listen: 127.0.0.1:1984
origin: '*'
ffmpeg:
bin: /nix/store/8s3h27dpxqqbvb6by2v5c3lfj7vs8v8y-ffmpeg-headless-8.1.1-bin/bin/ffmpeg
global: -hide_banner -v error -vaapi_device /dev/dri/renderD128
rtsp: {}
streams:
a_detect: rtsp://user:pass@a.local/live1s2.sdp
a_record:
- ffmpeg:rtsp://user:pass@a.local/live1s1.sdp#video=copy#audio=aac
- ffmpeg:a_record#audio=opus
c: ffmpeg:http://192.168.110.158:8080/?action=stream#video=h264#hardware
g_detect: rtsp://user:pass@g.local/live1s2.sdp
g_record:
- ffmpeg:rtsp://user:pass@g.local/live1s1.sdp#video=copy#audio=aac
- ffmpeg:g_record#audio=opus
d_detect: rtsp://user:pass@d.local/live1s2.sdp
d_record:
- ffmpeg:rtsp://user:pass@d.local/live1s1.sdp#video=copy#audio=aac
- ffmpeg:d_record#audio=opus
mb_detect: rtsp://user:pass@mb.local/live1s2.sdp
mb_record:
- ffmpeg:rtsp://user:pass@mb.local/live1s1.sdp#video=copy#audio=aac
- ffmpeg:mb_record#audio=opus
b_detect: rtsp://user:pass@b.local/live1s2.sdp
b_record:
- ffmpeg:rtsp://user:pass@b.local/live1s1.sdp#video=copy#audio=aac
- ffmpeg:b_record#audio=opus
al_detect: rtsp://user:pass@al.local/live1s2.sdp
al_record:
- ffmpeg:rtsp://user:pass@al.local/live1s1.sdp#video=copy#audio=aac
- ffmpeg:al_record#audio=opus
t_detect: rtsp://user:pass@t.local/live1s2.sdp
t_record:
- ffmpeg:rtsp://user:pass@t.local/live1s1.sdp#video=copy#audio=aac
- ffmpeg:t_record#audio=opus
webrtc:
candidates:
- 192.168.100.1:8555
model:
height: 320
input_pixel_format: rgb
input_tensor: nhwc
labelmap_path: /var/lib/frigate/coco-80-animal.txt
model_type: yolo-generic
path: /var/lib/frigate/models/yolov9-c-320.onnx
width: 320
motion:
contour_area: 20
frame_height: 240
improve_contrast: false
lightning_threshold: 0.3
threshold: 30
mqtt:
enabled: true
host: mqtt.local
objects:
filters:
animal:
min_score: 0.45
threshold: 0.6
car:
min_score: 0.45
threshold: 0.6
person:
min_score: 0.45
threshold: 0.6
track:
- person
- bicycle
- car
- motorcycle
- animal
record:
alerts:
post_capture: 10
pre_capture: 10
retain:
days: 15
mode: active_objects
detections:
post_capture: 10
pre_capture: 10
retain:
days: 10
mode: motion
enabled: true
events:
post_capture: 9
pre_capture: 9
retain:
days: 5
mode: all
review:
alerts:
labels:
- animal
- person
detections:
labels:
- animal
- person
- bicycle
- car
- motorcycle
snapshots:
enabled: false
telemetry:
stats:
amd_gpu_stats: false
intel_gpu_stats: false
version_check: falsedocker-compose file or Docker CLI commandN/ARelevant Frigate log output[2026-08-21 19:27:11] frigate.video ERROR : a: Unable to read frames from ffmpeg process.
(and so on for all cameras)Relevant go2rtc log outputNo output from go2rtcOperating systemOther Linux Install methodNixOS module Network connectionWired Camera make and modelVivotek 9380-H Screenshots of the Frigate UI's System metrics pagesN/A Any other information that may be helpfulClanker identifies Lines 1065 to 1076 in 036bae4 At minimum it should emit a warning on startup, but ideally IMO it should try to recreate the file so that frigate can be confident that the file is of correct size. |
Replies: 1 comment 4 replies
|
This behavior has been reported before with the same symptoms: after a detect resolution change, existing The identified code path is the same one you point to — the frame slots are pre-created per camera: for i in range(count):
frame_size = config.frame_shape_yuv[0] * config.frame_shape_yuv[1]
self.frame_manager.create(f"{config.name}_frame{i}", frame_size)and try:
shm = UntrackedSharedMemory(name=name, create=True, size=size)
except FileExistsError:
shm = UntrackedSharedMemory(name=name)which then fails at: frame_buffer[:] = ffmpeg_process.stdout.read(frame_size)Workaround: delete the camera's stale segments and restart so they are recreated at the correct size. Or, for a systemd-style install: systemctl kill --kill-whom=all frigate
rm -f /dev/shm/Office_frame*
systemctl reset-failed frigate
systemctl start frigateRelevant context on your install method: The suggested fix matches your proposal: on camera start, compare the size of existing For reference on sizing, 📚 Sources:
Have another question? Just tag @inkeep. |
This behavior has been reported before with the same symptoms: after a detect resolution change, existing
/dev/shm/<camera>_frame*segments remain at the old size, so reads misalign and the camera logsUnable to read frames from ffmpeg processindefinitely while the detect ffmpeg process stays healthy.(1), (2)
The identified code path is the same one you point to — the frame slots are pre-created per camera:
(2)
and
create()falls back to opening the existing segment without validating its size: