markdegrootnl / dockerfiles

Repository for my dockerfiles https://hub.docker.com/u/markdegroot
ISC License
14 stars 6 forks source link

Unifi Protect x86 consuming too much RAM over time... #4

Closed icaroscherma closed 3 years ago

icaroscherma commented 3 years ago

Hi, I will take a deeper look about what's causing this but I wanted to share here in case somebody else also face the same issue.

Yesterday I noticed that my NAS that contains my local DNS server and Unifi Protect running on it was receiving internet but wasn't being able to serve DNS. When I openend the docker containers I noticed that all of my RAM was being used by the Unifi Protect. As soon as I restarted the docker container, it started using just a little of RAM and the DNS server started working as usual.

I thought that was a random issue after running it for more than 2months non-stop so it was nothing to worry about.

Today I went to check the docker images and I found this: image

So apparently there's a memory leak somewhere.

icaroscherma commented 3 years ago

I ran a few tests and apparently Unifi Protect doesn't "garbage collect" the livestream you see on Protect App or Web version, but it overrides the last cache with the newer one. So if you have 2Gb of RAM you're fine, it will use 2Gb, if you have 16Gb, it will use 16Gb after a few hours/days. A quickfix it's to add -m or --memory= and set a memory limit.

If you use Synology or another GUI for Docker, you should find the option when you create/configure your container.

Images of Synology GUI below: image

image

I will create a PR with a suggestion for memory limiting this container.