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

[Support]: Frigate Crashes #8463

Closed
tdashmike opened this issue Nov 5, 2023 · 24 comments
Closed

[Support]: Frigate Crashes #8463

tdashmike opened this issue Nov 5, 2023 · 24 comments
Labels
beta Related to the current beta version of frigate stale support triage

Comments

@tdashmike
Copy link

tdashmike commented Nov 5, 2023

Describe the problem you are having

I'm running Frigate in docker. After a while it will crash the host computer.

Version

0.13.0-CD64399

Frigate config file

ui:
  live_mode: mse

ffmpeg:
  hwaccel_args: preset-intel-qsv-h264

mqtt:
  enabled: false

go2rtc:
  ffmpeg:
    wyze: -avoid_negative_ts make_zero -fflags +genpts+igndts+discardcorrupt -flags
      low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -timeout
      5000000 -i {input}
  streams:
    TDRIVEWAY:
    - ffmpeg:rtsp://192.168.1.40:8554/video2_unicast#video=copy#audio=aac#input=wyze
  webrtc:
    candidates:
    - 192.168.1.4:8555
    - stun:8555

cameras:
  TDRIVEWAY:
    ui:
      order: 5
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
      - path: rtsp://127.0.0.1:8554/TDRIVEWAY   # <----- The stream you want to use for detection
        roles:
        - detect
        - record
    detect:
      enabled: true # <---- disable detection until you have a working camera feed
      width: 640 # <---- update for your camera's resolution
      height: 360 # <---- update for your camera's resolution
    zones:
      driveway:
        coordinates: 469,108,640,168,640,360,0,360,0,0,21,0,35,82,142,41,304,68
    record:
      enabled: true

birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: true
  # Optional: Restream birdseye via RTSP (default: shown below)
  # NOTE: Enabling this will set birdseye to run 24/7 which may increase CPU usage somewhat.
  restream: false
  # Optional: Width of the output resolution (default: shown below)
  width: 1280
  # Optional: Height of the output resolution (default: shown below)
  height: 720
  # Optional: Encoding quality of the mpeg1 feed (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
  quality: 8
  # Optional: Mode of the view. Available options are: objects, motion, and continuous
  #   objects - cameras are included if they have had a tracked object within the last 30 seconds
  #   motion - cameras are included if motion was detected in the last 30 seconds
  #   continuous - all cameras are included always
  mode: continuous

record:
  enabled: true
  expire_interval: 60

  retain:
    days: 14
    mode: all

  events:
    pre_capture: 5
    post_capture: 5
    required_zones:
      - driveway
      - frontyard
      - sideyard
      - backyard
    retain:
      default: 31
      mode: motion

snapshots:
  # Optional: Enable writing jpg snapshot to /media/frigate/clips (default: shown below)
  enabled: true
  # Optional: save a clean PNG copy of the snapshot image (default: shown below)
  clean_copy: true
  # Optional: print a timestamp on the snapshots (default: shown below)
  timestamp: true
  # Optional: draw bounding box on the snapshots (default: shown below)
  bounding_box: true
  # Optional: crop the snapshot (default: shown below)
  crop: false
  # Optional: height to resize the snapshot to (default: original size)
  height: 300
  # Optional: Restrict snapshots to objects that entered any of the listed zones (default: no required zones)
  required_zones:
      - driveway

detectors:
  ov:
    type: openvino
    device: GPU
    model:
      path: /openvino-model/ssdlite_mobilenet_v2.xml

model:
  width: 300
  height: 300
  input_tensor: nhwc
  input_pixel_format: bgr
  labelmap_path: /openvino-model/coco_91cl_bkgr.txt

detect:
  # Optional: desired fps for your camera for the input with the detect role (default: shown below)
  # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
  fps: 5
  # Optional: enables detection for the camera (default: True)
  enabled: true
  stationary:
    interval: 50
    threshold: 50

objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
  - person
  - dog
  - cat
  - car
  - bear
  - bird
  - bicycle
  - bus

Relevant log output

2023-11-04 16:39:32.384732365  16:39:32.384 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY
2023-11-04 16:39:36.191946052  [2023-11-04 16:39:36] watchdog.TDRIVEWAY           ERROR   : Ffmpeg process crashed unexpectedly for TDRIVEWAY.
2023-11-04 16:39:36.192281014  [2023-11-04 16:39:36] watchdog.TDRIVEWAY           ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-11-04 16:39:36.192584964  [2023-11-04 16:39:36] ffmpeg.TDRIVEWAY.detect      ERROR   : rtsp://127.0.0.1:8554/TDRIVEWAY: Invalid data found when processing input
2023-11-04 16:39:41.380155984  [2023-11-04 16:39:41] frigate.video                  ERROR   : TDRIVEWAY: Unable to read frames from ffmpeg process.
2023-11-04 16:39:41.380305856  [2023-11-04 16:39:41] frigate.video                  ERROR   : TDRIVEWAY: ffmpeg process is not running. exiting capture thread...
2023-11-04 16:39:42.463435092  16:39:42.463 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY
2023-11-04 16:39:46.224205512  [2023-11-04 16:39:46] watchdog.TDRIVEWAY           ERROR   : Ffmpeg process crashed unexpectedly for TDRIVEWAY.
2023-11-04 16:39:46.224387072  [2023-11-04 16:39:46] watchdog.TDRIVEWAY           ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-11-04 16:39:46.224545800  [2023-11-04 16:39:46] ffmpeg.TDRIVEWAY.detect      ERROR   : rtsp://127.0.0.1:8554/TDRIVEWAY: Invalid data found when processing input
2023-11-04 16:39:51.380483340  [2023-11-04 16:39:51] frigate.video                  ERROR   : TDRIVEWAY: Unable to read frames from ffmpeg process.
2023-11-04 16:39:51.380674081  [2023-11-04 16:39:51] frigate.video                  ERROR   : TDRIVEWAY: ffmpeg process is not running. exiting capture thread...
2023-11-04 16:39:52.448516705  16:39:52.448 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY
2023-11-04 16:39:56.243518151  [2023-11-04 16:39:56] watchdog.TDRIVEWAY           ERROR   : Ffmpeg process crashed unexpectedly for TDRIVEWAY.
2023-11-04 16:39:56.243892437  [2023-11-04 16:39:56] watchdog.TDRIVEWAY           ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-11-04 16:39:56.244248514  [2023-11-04 16:39:56] ffmpeg.TDRIVEWAY.detect      ERROR   : rtsp://127.0.0.1:8554/TDRIVEWAY: Invalid data found when processing input
2023-11-04 16:40:01.464117021  [2023-11-04 16:40:01] frigate.video                  ERROR   : TDRIVEWAY: Unable to read frames from ffmpeg process.
2023-11-04 16:40:01.464634039  [2023-11-04 16:40:01] frigate.video                  ERROR   : TDRIVEWAY: ffmpeg process is not running. exiting capture thread...
2023-11-04 16:40:02.494438535  16:40:02.494 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY
2023-11-04 16:40:06.290304317  [2023-11-04 16:40:06] watchdog.TDRIVEWAY           ERROR   : Ffmpeg process crashed unexpectedly for TDRIVEWAY.
2023-11-04 16:40:06.290435194  [2023-11-04 16:40:06] watchdog.TDRIVEWAY           ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-11-04 16:40:06.290574023  [2023-11-04 16:40:06] ffmpeg.TDRIVEWAY.detect      ERROR   : rtsp://127.0.0.1:8554/TDRIVEWAY: Invalid data found when processing input
2023-11-04 16:40:11.435584722  [2023-11-04 16:40:11] frigate.video                  ERROR   : TDRIVEWAY: Unable to read frames from ffmpeg process.
2023-11-04 16:40:11.435607925  [2023-11-04 16:40:11] frigate.video                  ERROR   : TDRIVEWAY: ffmpeg process is not running. exiting capture thread...
2023-11-04 16:40:12.510400138  16:40:12.510 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY
2023-11-04 16:40:16.309731161  [2023-11-04 16:40:16] watchdog.TDRIVEWAY           ERROR   : Ffmpeg process crashed unexpectedly for TDRIVEWAY.
2023-11-04 16:40:16.309810416  [2023-11-04 16:40:16] watchdog.TDRIVEWAY           ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-11-04 16:40:16.309855669  [2023-11-04 16:40:16] ffmpeg.TDRIVEWAY.detect      ERROR   : rtsp://127.0.0.1:8554/TDRIVEWAY: Invalid data found when processing input
2023-11-04 16:40:21.435563283  [2023-11-04 16:40:21] frigate.video                  ERROR   : TDRIVEWAY: Unable to read frames from ffmpeg process.
2023-11-04 16:40:21.435714750  [2023-11-04 16:40:21] frigate.video                  ERROR   : TDRIVEWAY: ffmpeg process is not running. exiting capture thread...
�rror grabbing logs: invalid character 'l' after object key:value pair

FFprobe output from your camera

Do you need this?

Frigate stats

No response

Operating system

Other Linux

Install method

Docker CLI

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

Yi Home

Any other information that may be helpful

The log output above is from the docker instance. Looks like it just crashes without any warning other than the ffmpeg issues.

Trying vaapi right now but I remember it crashing before as well.

@NickM-27 NickM-27 added the beta Related to the current beta version of frigate label Nov 5, 2023
@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 5, 2023

I would suggest using preset-vaapi instead of qsv

Also, would be good to see go2rtc logs

@tdashmike
Copy link
Author

Trying vaapi right now but I remember it crashing also a few months ago.

I couldn't view the go2rtc log before it crashed before it looks like it's replacing the file on restart. This is the the current log:

2023-11-04 19:19:47.970745594 [INFO] Preparing go2rtc config... 2023-11-04 19:19:48.225587687 [INFO] Not injecting WebRTC candidates into go2rtc config as it has been set manually 2023-11-04 19:19:48.248530809 [INFO] Starting go2rtc... 2023-11-04 19:19:48.307998873 19:19:48.307 INF go2rtc version 1.8.1 linux/amd64 2023-11-04 19:19:48.308244622 19:19:48.308 INF [api] listen addr=0.0.0.0:1984 2023-11-04 19:19:48.308536197 19:19:48.308 INF [rtsp] listen addr=0.0.0.0:8554 2023-11-04 19:19:48.308702970 19:19:48.308 INF [webrtc] listen addr=0.0.0.0:8555/tcp 2023-11-04 19:19:55.402907938 19:19:55.402 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:19:57.967381914 [INFO] Starting go2rtc healthcheck service... 2023-11-04 19:29:57.194014505 19:29:57.193 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:30:07.214401613 19:30:07.214 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:30:17.259780503 19:30:17.259 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:30:27.311855212 19:30:27.311 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:30:37.357994551 19:30:37.357 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:30:47.306425697 19:30:47.306 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:30:57.354171397 19:30:57.354 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:31:07.402267378 19:31:07.402 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:31:17.448706035 19:31:17.448 WRN [rtsp] error="streams: exec: exit status 1" stream=TDRIVEWAY 2023-11-04 19:31:20.480826003 19:31:20.480 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://192.168.1.3:8554/tdriveway#video=copy#audio=aac#input=wyze

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 5, 2023

For starters I see an issue in your config, you're creating the stream as TDRIVEWAY but then you're referring to it in the camera config as T-DRIVEWAY which is incorrect.

@tdashmike
Copy link
Author

Fixed it. Any other logs you need to see?

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 5, 2023

Not unless there are errors

@tdashmike
Copy link
Author

So your saying if I don't want it to crash I have to eliminate all streaming erros? I can try but I think it would be extremely hard to have no errors from my wireless cameras.

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 5, 2023

I mean this error that was just fixed means previously the camera wasn't working at all. If an occasional error happens that's one thing but ongoing errors should be fixed.

@tdashmike
Copy link
Author

I'll try for a bit longer. I give the short version of the config with 1 camera but I have 8. There are a lot of errors and I don't know if I can resolve all of them. The fact that it crashes the host system is not sustainable as it stops all my other running services.

I've been using Motioneye and it never crashes but of course it has less features. If this doesn't work out I'll have to revert back again which is a bummer because I really like Frigate.

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 5, 2023

It's not normal for it to crash the host computer, it is a very rare issue, but camera errors makes it very difficult to diagnose why it would be happening. You can always use docker to set a memory limit on the container.

@tdashmike
Copy link
Author

tdashmike commented Nov 5, 2023

So it crashed this morning and these were the last messages in the log. My guess is that some of the frames were bad from the camera feeds. I did limit the memory usage to 4GB out of the 8GB I have and it still froze the host. I will try lowering it to 2GB.

2023-11-05T12:31:33.295622455Z 2023-11-05 07:31:33.295474749 [h264 @ 0x7faf0c5e55c0] left block unavailable for requested intra mode 2023-11-05T12:31:33.295659387Z 2023-11-05 07:31:33.295479130 [h264 @ 0x7faf0c5e55c0] error while decoding MB 0 12, bytestream 3599 2023-11-05T12:31:43.533789985Z 2023-11-05 07:31:43.533664985 [h264 @ 0x7faf0c562480] left block unavailable for requested intra4x4 mode -1 2023-11-05T12:31:43.533810168Z 2023-11-05 07:31:43.533668394 [h264 @ 0x7faf0c562480] error while decoding MB 0 22, bytestream 8323 2023-11-05T12:31:43.541240727Z 2023-11-05 07:31:43.541008050 [h264 @ 0x7faf0c562480] error while decoding MB 1 19, bytestream -5 2023-11-05T12:33:03.805427993Z 2023-11-05 07:33:03.805249840 [h264 @ 0x7faf0c123540] left block unavailable for requested intra4x4 mode -1 2023-11-05T12:33:03.805473794Z 2023-11-05 07:33:03.805253824 [h264 @ 0x7faf0c123540] error while decoding MB 0 9, bytestream 22460 2023-11-05T12:34:53.574217564Z 2023-11-05 07:34:53.574016238 [h264 @ 0x7faf0c123540] left block unavailable for requested intra4x4 mode -1 2023-11-05T12:34:53.574266163Z 2023-11-05 07:34:53.574022833 [h264 @ 0x7faf0c123540] error while decoding MB 0 16, bytestream 43627 2023-11-05T12:35:32.574268449Z 2023-11-05 07:35:32.574137136 [h264 @ 0x7faf0c123540] left block unavailable for requested intra4x4 mode -1 2023-11-05T12:35:32.574295157Z 2023-11-05 07:35:32.574139861 [h264 @ 0x7faf0c123540] error while decoding MB 0 16, bytestream 23189 2023-11-05T12:36:33.902894003Z 2023-11-05 07:36:33.902734640 [h264 @ 0x7faf0c55c2c0] left block unavailable for requested intra4x4 mode -1 2023-11-05T12:36:33.902921654Z 2023-11-05 07:36:33.902738575 [h264 @ 0x7faf0c55c2c0] error while decoding MB 0 2, bytestream 38319

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 5, 2023

This looks like an old version of frigate 0.13. Where happens when it crashes exactly?

@tdashmike
Copy link
Author

2023-11-05 09:26:13.477734255 [INFO] Preparing Frigate...
2023-11-05 09:26:13.487541696 [INFO] Starting Frigate...
2023-11-05 09:26:14.776312054 [2023-11-05 09:26:14] frigate.app INFO : Starting Frigate (0.13.0-cd64399)
2023-11-05 09:26:14.833696457 [2023-11-05 09:26:14] frigate.config WARNING : Customizing more than a detector model path is unsupported.
2023-11-05 09:26:14.859236110 [2023-11-05 09:26:14] peewee_migrate.logs INFO : Starting migrations
2023-11-05 09:26:14.862447405 [2023-11-05 09:26:14] peewee_migrate.logs INFO : There is nothing to migrate
2023-11-05 09:26:14.866589558 [2023-11-05 09:26:14] frigate.app INFO : Recording process started: 440
2023-11-05 09:26:14.868523429 [2023-11-05 09:26:14] frigate.app INFO : go2rtc process pid: 89
2023-11-05 09:26:14.887873899 [2023-11-05 09:26:14] detector.ov INFO : Starting detection process: 448
2023-11-05 09:26:14.892168260 [2023-11-05 09:26:14] frigate.app INFO : Output process started: 450

The host freezes, I cannot ssh in and all my other services are not working. I have to power cycle the server. I had htop open one time when it crashed and all the stats looked normal to me. CPU usage wasn't too high.

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 5, 2023

Then I'd suggest following #8470 (comment)

@tdashmike
Copy link
Author

tdashmike commented Nov 5, 2023

I'm trying one camera now but I think some extra logging still needs to be done but I'm not sure how or what to log. Any tips are appreciated.

ui:
  live_mode: mse

ffmpeg:
  hwaccel_args: preset-vaapi

mqtt:
  enabled: false

cameras:
  TGARAGE: # <------ Name the camera
    ui:
      order: 4
    ffmpeg:
      inputs:
      - path: rtsp://192.168.7.44:554/ch0_0.h264   # <----- The stream you want to use for detection
        roles:
        - detect
        - record
    detect:
      enabled: false # <---- disable detection until you have a working camera feed
      width: 1280 # <---- update for your camera's resolution
      height: 720 # <---- update for your camera's resolution
    record:
      enabled: true

@blakeblackshear
Copy link
Owner

Remove your hwaccel args too.

@tdashmike
Copy link
Author

Done!

@tdashmike
Copy link
Author

tdashmike commented Nov 10, 2023

Seems fine for a few days now. Do you want me to add preset-intel-qsv-h264 or preset-vaapi next?

@NickM-27
Copy link
Collaborator

preset-vaapi

@tdashmike
Copy link
Author

Running now.

ui:
  live_mode: mse

ffmpeg:
  hwaccel_args: preset-vaapi

mqtt:
  enabled: false

cameras:
  TGARAGE: # <------ Name the camera
    ui:
      order: 4
    ffmpeg:
      inputs:
      - path: rtsp://192.168.7.44:554/ch0_0.h264   # <----- The stream you want to use for detection
        roles:
        - detect
        - record
    detect:
      enabled: false # <---- disable detection until you have a working camera feed
      width: 1280 # <---- update for your camera's resolution
      height: 720 # <---- update for your camera's resolution
    record:
      enabled: true

@tdashmike
Copy link
Author

I have added more cameras since then and add input_args for ffmpeg but it crashed a few days ago so I removed the input args and it's been running fine for a few days. I am not sure which of these args are causing the issue or a combination of them.

input_args: -fflags +genpts+flush_packets+nobuffer+bitexact -analyzeduration 1000 -probesize 1000 -flags +low_delay -thread_queue_size 100 -r 29.70 -flags +global_header

@NickM-27
Copy link
Collaborator

These args seem weird in general, is there a reason to not just let it use the default args if everything is working?

@tdashmike
Copy link
Author

Well, there were a lot of stream errors and after googling, it seemed there were quite a few posts on adding similar args. It was also a rabbit hole thing where I thought the crash was caused by the stream so I spend a lot of time working on the input args. These particular args were from the wz mini hack go2rtc config file. I had different ones when I first started a few months ago.

Will test it for a few more days before adding more functionally back in the config file.

@tdashmike
Copy link
Author

tdashmike commented Nov 24, 2023

Well, it crashed again after I added everything back, going back to the config before expect I enabled recording this time. One thing I noticed is that when logging into the server through SSH, it said there were 16 zombie processes. After an hour later, there are now 32 of them. They don't appear to be taking up any memory though.

Happy Thanksgiving!

~$ ps axo stat,ppid,pid,comm | grep -w defunct
Z       1857    2667 ffmpeg <defunct>
Z       1857    3737 ffmpeg <defunct>
Z       2571   33081 ffmpeg <defunct>
Z       1857   33136 ffmpeg <defunct>
Z       1857   33144 ffmpeg <defunct>
Z       1857   33153 ffmpeg <defunct>
Z       1857   33161 ffmpeg <defunct>
Z       1857   36859 ffmpeg <defunct>
Z       1857   36891 ffmpeg <defunct>
Z       1857   36895 ffmpeg <defunct>
Z       1857   36899 ffmpeg <defunct>
Z       1857   36909 ffmpeg <defunct>
Z       1857   36918 ffmpeg <defunct>
Z       1857   37007 ffmpeg <defunct>
Z       1857   38038 ffmpeg <defunct>
Z       1857   38135 ffmpeg <defunct>
Z       1857   38150 ffmpeg <defunct>
Z       2571   38901 ffmpeg <defunct>
Z       2571   41859 ffmpeg <defunct>
Z       1857   41986 ffmpeg <defunct>
Z       1857   41995 ffmpeg <defunct>
Z       1857   42004 ffmpeg <defunct>
Z       1857   42012 ffmpeg <defunct>
Z       1857   43392 ffmpeg <defunct>
Z       1857   43486 ffmpeg <defunct>
Z       1857   43489 ffmpeg <defunct>
Z       1857   43491 ffmpeg <defunct>
Z       1857   43494 ffmpeg <defunct>
Z       1857   43535 ffmpeg <defunct>
Z       1857   43544 ffmpeg <defunct>
Z       1857   43820 ffmpeg <defunct>
Z       1857   44692 ffmpeg <defunct>
Screenshot 2023-11-23 222457

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 25, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Related to the current beta version of frigate stale support triage
Projects
None yet
Development

No branches or pull requests

3 participants