frigate icon indicating copy to clipboard operation
frigate copied to clipboard

[Support]: Updating shm_size for container doesn't fix "Python bus error"

Open rplankenhorn opened this issue 2 years ago • 6 comments

Describe the problem you are having

I have three Amcrest cameras: 2x ASH42-B and 1x AD410. Everything was working fine with just one camera each but when I added the third camera (ASH42-B), things started to break. I first started getting the Python bus error and when I updated the daemon.json file to set a default-shm-size of 192M, I continued to get the error. I've since lowered the size down to 128M but that still doesn't fix the error.

I've since used the Amcrest IP tool to change the stream for h.265 to h.264 for each camera and even lowered the resolution down to 720p but nothing seems to consistently work. When I run on 720p, it works for a very short while but then I get the bus error again.

The other weird thing I am seeing it that when I click on "Cameras" in the web UI, all components in the window shake for some reason.

I'm also running Frigate inside Portainer on a Raspberry Pi.

Version

0.10.1-83481AF

Frigate config file

detectors:
  coral:
    type: edgetpu
    device: usb
mqtt:
  host: 192.168.86.10
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: xxxx
  password: xxxx
  stats_interval: 60

birdseye:
  enabled: True
  mode: continuous
  width: 2560
  height: 1920
  quality: 8

detect:
  enabled: True
  max_disappeared: 25
  width: 2560
  height: 1920
  fps: 5

record:
  enabled: True
  retain:
    days: 30
    mode: all

objects:
  track:
    - person
    - car
    - truck
    - bicycle
    - motorcycle
    - dog
    - cat

motion:
  threshold: 25

snapshots:
  enabled: True
  timestamp: True
  bounding_box: True
  retain:
    default: 10
    objects:
      person: 15

ffmpeg:
  global_args:
    - -hide_banner
    - -loglevel
    - info
  # input_args:
  #   - -avoid_negative_ts
  #   - make_zero
  #   - -fflags
  #   - +genpts+discardcorrupt
  #   - -rtsp_transport
  #   - tcp
  #   - -stimeout
  #   - '5000000'
  #   - -use_wallclock_as_timestamps
  #   - '1'

cameras:
  front_door:
    ffmpeg:
      inputs:
        - path: rtsp://xxxx:xxxx@xxxx:554/cam/realmonitor?channel=1&subtype=0 
          roles:
            - record
            - detect
    # objects:
    #   track:
    #     - person
    #     - car
    #     - truck
    #     - bicycle
    #     - motorcycle
    #     - dog
    #     - cat
    # detect:
    #   enabled: True
    #   max_disappeared: 25
    #   width: 2560
    #   height: 1920
    #   fps: 5
  pool:
    ffmpeg:
      inputs:
        - path: rtsp://yyyy:yyyy@yyyy:554/cam/realmonitor?channel=1&subtype=0 
          roles:
            - record
            - detect
    # objects:
    #   track:
    #     - person
    #     - dog
    #     - cat
    #     - bird
    #     - bear
    #     - horse
  side_driveway:
    ffmpeg:
      inputs:
        - path: rtsp://zzzz:zzzz@zzzz:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - detect
    # objects:
    #   track:
    #     - person
    #     - dog
    #     - cat
    #     - bird
    #     - bear
    # detect:
    #   enabled: True
    #   max_disappeared: 25
    #   width: 2560
    #   height: 1440
    #   fps: 5

Relevant log output

[2022-07-11 19:26:58] frigate.app                    INFO    : Capture process started for pool: 229

[2022-07-11 19:26:58] frigate.app                    INFO    : Capture process started for side_driveway: 231

[2022-07-11 19:26:58] ws4py                          INFO    : Using epoll

[2022-07-11 19:27:00] frigate.edgetpu                INFO    : TPU found

[2022-07-11 19:27:06] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:51146]

[2022-07-11 19:27:09] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51598]

[2022-07-11 19:27:10] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51598]

[2022-07-11 19:27:11] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51612]

Fatal Python error: Fatal Python error: Bus errorBus error




Thread 0xThread 0xb35b9460b35b9460 (most recent call first):

 (most recent call first):

  File   File ""//uussrr//lliib/python3.8/threading.py", line 302 in wait

  File "/b/uspry/tlhiob/pynt3h.o8n/3t.8/multiprocessing/queues.py", line 227 in _feed

  File "/usr/lib/python3.8/threading.py", line 870 in run

  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner

  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap


Current thread 0xb4dba460 (most recent call first):

  File "/opt/frigate/frigate/video.py", line hreading.py", line 302 in wait

  File "/usr/lib/python3.154 in capture_frames

  File "/opt/frigate/frigate/video.py", line 293 in run

  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner

  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap


Thread 0xb55bb460 (most recent call first):

  File "/usr/lib/python3.8/multiprocessing/synchronize.py", line 261 in wait

  File "/usr/lib/python3.8/multiprocessing/synchronize.py", line 349 in wait

  File "/opt/frigate/frigate/video.py", line 219 in run

  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner

  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap


Thread 0xa85e4460 (most recent call first):

  File "/opt/frigate/frigate/log.py", line 65 in run

  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner

  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap


Thread 0xb6ff2460 (most recent call first):

  File "/usr/lib/python3.8/threading.py", line 1027 in _wait_for_tstate_lock

  File "/usr/lib/python3.8/threading.py", line 1011 in join

  File "/opt/frigate/frigate/video.py", line 324 in capture_camera

  File "/usr/lib/python3.8/multiprocessing/pr8/multiprocessing/queues.py", line 227 in _feed

  File "/usr/lib/python3.8/threading.py", line 870 in run

  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner

  File "/usr/liob/python3.8/thcreesasd.ipny", line 108 in run

  File "/usr/lib/python3.8/multiprocessing/process.py", line 315 in _bootstrap

  File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 75 in _launch

  File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 19 in __init__

  File "/usr/lib/python3.8/multiprocessg.py", line 890 in _bootstrap


Current thread 0xb4dba460 (most recent call first):

  File "/opt/frigate/frigate/video.py", line 154 in capture_frames

  File "/opt/frigate/frigate/video.py", line 293 in run

  File "/usr/lib/python3.8/threading.py", line ing/co932n in t_ext.py", line 277 in _Popen

  File "/usr/lib/python3.8/multiprocessing/context.py", line 224 in _Popen

  File "/usr/lib/python3.8/multiprocessing/process.py", line 121 in start

  File "/opt/frigate/frigate/app.py", line 266 in start_camera_capture_processes

  File "/opt/frigate/frigate/app.py", line 344 in start

  File "/opt/frigate/frigate/__main__.py", line 17 in <module>

  File "/usr/lib/python3.8/runpy.py", line 87 in _run_code

  File "/usr/lib/python3.8/runpy.py", line 194 in _run_module_as_main

bootstrap_inner

  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap


Thread 0xb55bb460 (most recent call first):

  File "/usr/lib/python3.8/multiprocessing/synchronize.py", line 261 in wait

  File "/usr/lib/python3.8/multiprocessing/synchronize.py", line 349 in wait

  File "/opt/frigate/frigate/video.py", line 219 in run

  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner

  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap


Thread 0xa85e4460 (most recent call first):

  File "/opt/frigate/frigate/log.py", line 65 in run

  File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner

  File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap


Thread 0xb6ff2460 (most recent call first):

  File "/usr/lib/python3.8/threading.py", line 1027 in _wait_for_tstate_lock

  File "/usr/lib/python3.8/threading.py", line 1011 in join

  File "/opt/frigate/frigate/video.py", line 324 in capture_camera

  File "/usr/lib/python3.8/multiprocessing/process.py", line 108 in run

  File "/usr/lib/python3.8/multiprocessing/process.py", line 315 in _bootstrap

  File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 75 in _launch

  File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 19 in __init__

  File "/usr/lib/python3.8/multiprocessing/context.py", line 277 in _Popen

  File "/usr/lib/python3.8/multiprocessing/context.py", line 224 in _Popen

  File "/usr/lib/python3.8/multiprocessing/process.py", line 121 in start

  File "/opt/frigate/frigate/app.py", line 266 in start_camera_capture_processes

  File "/opt/frigate/frigate/app.py", line 344 in start

  File "/opt/frigate/frigate/__main__.py", line 17 in <module>

  File "/usr/lib/python3.8/runpy.py", line 87 in _run_code

  File "/usr/lib/python3.8/runpy.py", line 194 in _run_module_as_main

[2022-07-11 19:27:13] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51612]

[2022-07-11 19:27:13] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51634]

[2022-07-11 19:27:25] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51634]

[2022-07-11 19:27:29] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51680]

[2022-07-11 19:27:33] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51680]

[2022-07-11 19:27:33] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:51696]

FFprobe output from your camera

Could not get this to work with authentication.

Frigate stats

No response

Operating system

Other Linux

Install method

Docker Compose

Coral version

USB

Network connection

Wireless

Camera make and model

Amcrest AD410 and Amcrest ASH42-B

Any other information that may be helpful

No response

rplankenhorn avatar Jul 11 '22 18:07 rplankenhorn

I've since lowered the size down to 128M but that still doesn't fix the error.

If it's failing then the value needs to be increased not decreased

NickM-27 avatar Jul 11 '22 19:07 NickM-27

@NickM-27 I've tried increasing it up to 256MB but that causes the whole system to not load.

rplankenhorn avatar Jul 12 '22 17:07 rplankenhorn

@NickM-27 I've tried increasing it up to 256MB but that causes the whole system to not load.

How much RAM does your Pi have / utilized? Sounds like it may not have enough to support the load

NickM-27 avatar Jul 12 '22 17:07 NickM-27

It's a Raspberry Pi 4 Model B Rev 1.4 with 8 GB of RAM. Should be plenty for this application.

rplankenhorn avatar Jul 12 '22 19:07 rplankenhorn

Then there must be something else going wrong, I don't see how increasing shm would lock the system up unless it can't provide that memory.

NickM-27 avatar Jul 12 '22 19:07 NickM-27

@rplankenhorn make sure you are not swapping...

Can you paste the output of the following commands:

# grep swap /etc/fstab

And:

# sysctl -a | grep swappiness

joelsdc avatar Jul 17 '22 21:07 joelsdc

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.

stale[bot] avatar Aug 17 '22 06:08 stale[bot]