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

Crashes after a few days - memory leak? #22

Open
jfarre20 opened this issue Mar 25, 2023 · 6 comments
Open

Crashes after a few days - memory leak? #22

jfarre20 opened this issue Mar 25, 2023 · 6 comments

Comments

@jfarre20
Copy link

Got this after a few days uptime, restarted the container and it did it again after a few days

Failed to process image: RuntimeError: memory access out of bounds

     at wasm://wasm/01728d26:wasm-function[124]:0xfa9c
     at wasm://wasm/01728d26:wasm-function[12338]:0x51848c
     at Module.dynCall_iiiii (/app/lib/opencv/opencv.js:30:8275315)
     at dynCall_iiiii_9 (eval at makeDynCaller (/app/lib/opencv/opencv.js:30:8226307), <anonymous>:4:12)
     at Mat.constructor_body (/app/lib/opencv/opencv.js:30:8235294)
     at Mat.<anonymous> (/app/lib/opencv/opencv.js:30:8229032)
     at new Mat (eval at createNamedFunction (/app/lib/opencv/opencv.js:30:8206372), <anonymous>:4:34)
     at RawImage.toMat (file:///app/lib/RawImage.js:174:15)
     at MaskImageFilter.next (file:///app/lib/MaskImageFilter.js:15:24)
     at PlateMinder.next (file:///app/lib/PlateMinder.js:122:18)

 Failed to process image: RuntimeError: memory access out of bounds
     at wasm://wasm/01728d26:wasm-function[124]:0xfa9c
     at wasm://wasm/01728d26:wasm-function[12338]:0x51848c
     at Module.dynCall_iiiii (/app/lib/opencv/opencv.js:30:8275315)
     at dynCall_iiiii_9 (eval at makeDynCaller (/app/lib/opencv/opencv.js:30:8226307), <anonymous>:4:12)
     at Mat.constructor_body (/app/lib/opencv/opencv.js:30:8235294)
     at Mat.<anonymous> (/app/lib/opencv/opencv.js:30:8229032)
     at new Mat (eval at createNamedFunction (/app/lib/opencv/opencv.js:30:8206372), <anonymous>:4:34)
     at RawImage.toMat (file:///app/lib/RawImage.js:174:15)
     at MaskImageFilter.next (file:///app/lib/MaskImageFilter.js:15:24)
     at PlateMinder.next (file:///app/lib/PlateMinder.js:122:18)

Error would repeat and spam the console

@jfarre20 jfarre20 changed the title Crashes after a few days Crashes after a few days - memory leak? Mar 26, 2023
@sclaflin
Copy link
Owner

This error has an open issue with OpenCV.js: opencv/opencv#19397

Though I'm not convinced it isn't something I've done. Are you able to check memory usage when it first starts, maybe a day later, and finally when the error crops up? Maybe there's a memory leak somewhere.

@jfarre20
Copy link
Author

jfarre20 commented Mar 28, 2023

This error has an open issue with OpenCV.js: opencv/opencv#19397

Maybe there's a memory leak somewhere.

there's very much a memory leak, it starts at around 4g used and after a day it's around 8g

I set the container to cap memory to 6.5 gigs, and this seems to restart the container once it goes over that

I have two 4K cameras H265, 15 fps. I'm not sure if the memory leak is coming from FFmpeg.

@sclaflin
Copy link
Owner

Can you post your (sanitized) config here? I'd like to try and replicate the issue.

@jfarre20
Copy link
Author

jfarre20 commented Mar 28, 2023

sources:
  - type: rtsp
    name: Cam2
    captureInterval: 1
    preInputArgs: []
    preOutputArgs: []
    alwaysRestart: true
    url: rtsp://UN:[email protected]/cam/realmonitor?channel=28&subtype=0
  - type: rtsp
    name: Cam3
    captureInterval: 1
    preInputArgs: []
    preOutputArgs: []
    alwaysRestart: true
    url: rtsp://UN:[email protected]/cam/realmonitor?channel=30&subtype=0
filters:
  - type: mask
    debug: false
    shapes:
      - 0,0,700,0,3840,0,3840,1460
      - 0,1960,0,2160,560,2160,560,1960
  - type: motion
    debug: false
openALPR:
  url: http://open-alpr-http-wrapper:3000/detect
  country_code: us
  pattern: nc
recorders:
  - type: mqtt
    url: mqtt://homeassistant.DOMAIN.local:1883
    baseTopic: plate-minder
    mqttOptions:
      username: mqttunhere
      password: mqttpwhere
    hassDiscovery:
      enable: true
      discoveryPrefix: homeassistant
  - type: file
    pattern: ./images/{{DATE}}/{{SOURCE}}/{{TIME}}_{{PLATE}}.jpeg
    retainDays: 30
  - type: sqlite
restService:
  enable: true
  port: 4000

@jfarre20
Copy link
Author

also the docker compose

version: "3.9"
services:
  plate-minder:
    container_name: plate-minder
    restart: unless-stopped
    image: sclaflin/plate-minder:latest
    deploy:
      resources:
        limits:
          memory: 6.5g
    ports:
      - 4000:4000
    volumes:
      # Set's the docker container to the host container local time
      - /etc/localtime:/etc/localtime:ro
      - /data/plateminder/data:/app/data
      - /data/plateminder/config.yaml:/app/config.yaml
  open-alpr-http-wrapper:
    container_name: open-alpr-http-wrapper
    restart: unless-stopped
    image: sclaflin/open-alpr-http-wrapper:latest
  # This service is not required, but exists to help with configuration. Once 
  # Plate-Minder has been configured, feel free to disable this service.
  plate-minder-web:
    container_name: plate-minder-web
    image: sclaflin/plate-minder-web:latest
    restart: unless-stopped
    # The default configuration assumes docker is running on the same machine 
    # you're viewing the web UI with. If you're accessing the service from a
    # different computer, you should set the PLATE_MINDER_URL to whatever host 
    # & port Plate-Minder's RESTful service is accessible from.
    environment:
      - PLATE_MINDER_URL=http://10.8.8.8:4000
    ports:
      - 8100:80

@crookedmosquito
Copy link

crookedmosquito commented Jan 11, 2024

Seeing same issue:

Failed to process image: RuntimeError: memory access out of bounds
at wasm://wasm/01728d26:wasm-function[124]:0xfa9c
at wasm://wasm/01728d26:wasm-function[12338]:0x51848c
at Module.dynCall_iiiii (/app/lib/opencv/opencv.js:30:8275315)
at dynCall_iiiii_9 (eval at makeDynCaller (/app/lib/opencv/opencv.js:30:8226307), :4:12)
at Mat.constructor_body (/app/lib/opencv/opencv.js:30:8235294)
at Mat. (/app/lib/opencv/opencv.js:30:8229032)
at new Mat (eval at createNamedFunction (/app/lib/opencv/opencv.js:30:8206372), :4:34)
at RawImage.toMat (file:///app/lib/RawImage.js:174:15)
at MaskImageFilter.next (file:///app/lib/MaskImageFilter.js:15:24)
at PlateMinder.next (file:///app/lib/PlateMinder.js:122:18)
Failed to process image: RuntimeError: memory access out of bounds
at wasm://wasm/01728d26:wasm-function[124]:0xfa9c
at wasm://wasm/01728d26:wasm-function[12338]:0x51848c
at Module.dynCall_iiiii (/app/lib/opencv/opencv.js:30:8275315)
at dynCall_iiiii_9 (eval at makeDynCaller (/app/lib/opencv/opencv.js:30:8226307), :4:12)
at Mat.constructor_body (/app/lib/opencv/opencv.js:30:8235294)
at Mat. (/app/lib/opencv/opencv.js:30:8229032)
at new Mat (eval at createNamedFunction (/app/lib/opencv/opencv.js:30:8206372), :4:34)
at RawImage.toMat (file:///app/lib/RawImage.js:174:15)
at MaskImageFilter.next (file:///app/lib/MaskImageFilter.js:15:24)
at PlateMinder.next (file:///app/lib/PlateMinder.js:122:18)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants