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

nginx error 12: Cannot allocate memory #1706

Open
FM-17 opened this issue Sep 5, 2021 · 12 comments
Open

nginx error 12: Cannot allocate memory #1706

FM-17 opened this issue Sep 5, 2021 · 12 comments
Labels
bug Something isn't working pinned

Comments

@FM-17
Copy link
Contributor

FM-17 commented Sep 5, 2021

Describe the bug
Frigate 9.0+ is failing to start due to an nginx related memory error on my Google Coral Dev Board. Frigate 8.4 runs fine. This is my first attempt at frigate so I apologize if this was caused by a minor oversight.

Version of frigate
frigate:0.9.0-rc2-aarch64

Config file

mqtt:
  host: <ANON_HOST_IP>
  port: 1883
  topic_prefix: frigate
detectors:
  coral:
    type: edgetpu
    device: ''
cameras:
  front_door:
    ffmpeg:
      inputs:
        - path: rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@{FRIGATE_RTSP_IP}:554/stream2
          roles:
            - detect
            - record
    detect:
      width: 640
      height: 360
      fps: 5
      enabled: True
      max_disappeared: 25
    motion:
      mask: 0,0,238,0,236,25,0,25
    record:
      enabled: False
      retain_days: 0
      events:
        enabled: True
        pre_capture: 5
        post_capture: 5
        objects:
          - person
        required_zones: []
        retain:
          default: 10
          objects:
            person: 15
    rtmp:
      enabled: False
    live:
      height: 360
      quality: 8
    objects:
      track:
        - person

Frigate container logs

fm@coral:~/home$ docker-compose up
Starting frigate ... done
Attaching to frigate
frigate    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
frigate    | [s6-init] ensuring user provided files have correct perms...exited 0.
frigate    | [fix-attrs.d] applying ownership & permissions fixes...
frigate    | [fix-attrs.d] done.
frigate    | [cont-init.d] executing container initialization scripts...
frigate    | [cont-init.d] done.
frigate    | [services.d] starting services
frigate    | [services.d] done.
frigate    | nginx: [alert] mmap(MAP_ANON|MAP_SHARED, 536870912) failed (12: Cannot allocate memory)
frigate    | nginx: [alert] munmap(FFFFFFFFFFFFFFFF, 536870912) failed (22: Invalid argument)
frigate    | [cont-finish.d] executing container finish scripts...
frigate    | [cont-finish.d] done.
frigate    | [s6-finish] waiting for services.
frigate    | [s6-finish] sending all processes the TERM signal.
frigate    | [s6-finish] sending all processes the KILL signal and exiting.

FFprobe from camera

 ffprobe rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@{FRIGATE_RTSP_IP}:554/stream2
ffprobe version 3.4.8-0ubuntu0.2 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, rtsp, from 'rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@{FRIGATE_RTSP_IP}:554/stream2':
  Metadata:
    title           : Session streamed by "TP-LINK RTSP Server"
    comment         : stream2
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 640x360, 15 fps, 15 tbr, 90k tbn, 30 tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s

Computer Hardware

  • OS: Mendel Linux (Debian 8)
  • Install method: Docker Compose
  • Coral Version: Coral Dev Board
  • Network Setup: Ethernet

Camera Info:

  • Manufacturer: TP-Link
  • Model: Tapo C100 (also tested with C200)
  • Resolution: Using 640x360 stream
  • FPS: 5

Additional context
I am starting Frigate from a docker container using the following docker-compose config:

version: "3.9"
services:
  frigate:
    container_name: frigate
    image: blakeblackshear/frigate:0.9.0-rc2-aarch64
    privileged: true 
    restart: unless-stopped
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - $FRIGATE_DATA_PATH/config.yml:/config/config.yml:ro
      - $FRIGATE_MEDIA_PATH:/media/frigate
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
      - "1883:1883"
    environment:
      FRIGATE_RTSP_PASSWORD: $FRIGATE_RTSP_PASSWORD
      FRIGATE_RTSP_USER: $FRIGATE_RTSP_USER

My /etc/docker/daemon.json file is as follows:

{
    "default-shm-size": "256M"
}
@blakeblackshear
Copy link
Owner

It's probably some kind of issue with the custom nginx build that is not compatible with the Coral Dev board. This happened once for another dependency. It's virtually impossible for me to track down without having a dev board.

@FM-17
Copy link
Contributor Author

FM-17 commented Sep 5, 2021

Right on, is there anything I can do to lend a hand, given that I have a dev board?

@blakeblackshear
Copy link
Owner

My best guess is that something needs to change here: https://github.com/blakeblackshear/frigate/blob/release-0.9.0/docker/Dockerfile.nginx

@FM-17
Copy link
Contributor Author

FM-17 commented Sep 5, 2021

Sounds good, I'll take a look.

@stale
Copy link

stale bot commented Oct 5, 2021

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 stale bot added the stale label Oct 5, 2021
@travipross
Copy link

+1

@ozett
Copy link

ozett commented Nov 9, 2021

maybe the memory is allocated by VOD on the coral-dev-board since 0.9x.
and maybe it oculd be configured to give up that allocation

@nickrout
Copy link

Does anyone know if this has been fixed? I am keen to try frigate, but the only corals I can find are dev boards. GRRR global chip shortage

@ozett
Copy link

ozett commented Jan 31, 2022

up to now unchanged, i guess.
latest 10-beta 6 seems still to have a unchanged high vod value in the sourccode...

vod_metadata_cache metadata_cache 512m;

@nickrout
Copy link

Thanks.

@addrum
Copy link

addrum commented Jan 31, 2023

I'm also hitting this but with a USB Coral on the latest stable frigate.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
nginx: [alert] mmap(MAP_ANON|MAP_SHARED, 536870912) failed (12: Cannot allocate memory)
nginx: [alert] munmap(FFFFFFFFFFFFFFFF, 536870912) failed (22: Invalid argument)
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

@velkrosmaak
Copy link

I'm getting the exact same trying to do this without a Coral, only CPU.

@NickM-27 NickM-27 added the bug Something isn't working label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinned
Projects
None yet
Development

No branches or pull requests

8 participants