iEvgeny / cctv-viewer

CCTV Viewer - viewer and mounter video streams.
GNU General Public License v3.0
135 stars 19 forks source link

Increasing RAM usage leading to crash on low-power hardware - Ubuntu 22.04 #82

Closed tylermatthew closed 8 months ago

tylermatthew commented 8 months ago

Good evening!

I have the latest version of cctv-viewer (from PPA) running in Ubuntu 22.04 on a fairly low-powered computer.

It's configured to receive 5 low resolution (640x360) rtsps streams from a Unifi UNVR. The application appears to use increasing amounts of RAM until it eventually crashes.

I had the snap package installed earlier today as well to test, and it behaved the same way.

More info/context:

Computer - MINIX NEO Z83-4 (v1.1); CPU - Intel Atom x5-Z8350; RAM - (as reported by the os) 3707 total Mem, 3119 total Swap; OS - ubuntu 22.04.4 LTS, linux 6.5.0-21-generic

I understand this machine might be below the intended performance, haha. I had previously deployed them to serve as live-view monitors for a unifi video deployments in a couple of places, since at the time they had no real native solution for that. Eventually unifi made the view-port and I deployed those instead. they honestly worked fairly well after writing a bash script to work around the crashing!

Today I just happened to see cctv-viewer on a youtube channel, and it reminded me I had those decommissioned computers on a shelf. I took one out to test the latest build and see if that issue had improved in my particular setup, which it unfortunately hasn't.

I never reported the issue initially, so I thought I should now after re-testing the latest version. I'm happy to provide any logging or information you need!

Thanks, -tm

iEvgeny commented 8 months ago

Hi! First, please provide diagnostic output including time to crash using this command: cctv-viewer -l 2 > log.txt 2>&1 The file may be large, please send it to me by email or use GitHub Gist.

tylermatthew commented 8 months ago

Current behavior is actually that it just runs until the memory fills, and the whole system becomes unresponsive, didn't (strictly speaking) get a crash.

Here's a gist link for the log: https://gist.github.com/tylermatthew/9e8d21bfebc111f6a50ad92fbb53139f

iEvgeny commented 8 months ago

Thanks! I seem to have been able to reproduce the problem on a Raspberry Pi 4 (Raspberry Pi OS 10, 4GB, armhf) for Snap. Please wait.

iEvgeny commented 8 months ago

Please provide the output of the following commands: $ dpkg --print-architecture $ uname -a

tylermatthew commented 8 months ago

amd64

Linux user 6.5.0-21-generic #21-22.04.1-ubuntu SMP PREEMPT_DYNAMIC Fri Feb 9 13:32:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

iEvgeny commented 8 months ago

I made some changes. Please test latest version.

tylermatthew commented 8 months ago

Here's a log from running the latest version today.

https://gist.github.com/tylermatthew/9a6ddaabb25a7e2e14b5c7b917a4897b

Fairly similar behavior to before, also resulting in a hang of the system.

iEvgeny commented 8 months ago

Yes. It seems I have discovered another memory leak issue for some audio stream formats. Please wait for a fix.

iEvgeny commented 8 months ago

Fix has been released. Please test it.

tylermatthew commented 8 months ago

I've had it running for about 2.5 hours, and the RAM usage appears to be completely stable between 1.05-1.07 GB for the moment. I'll leave it overnight and link the log for it, but I thought I'd go ahead and update!

tylermatthew commented 8 months ago

Hi again,

After about 24 hours, the RAM usage is still stable between 1.05-1.15 GB. The log file ended up being 1.7GB, if you'd like me to link it somewhere i'd be happy to -- but after the startup it's just many many many lines of the "audio exceeded 1MB" log.

Let me know if you need anything else from me, otherwise feel free to close the issue -- I really appreciate the fix!

iEvgeny commented 8 months ago

Of course, a log is not needed. There will still be some related improvements to be made on this issue, in case of regressions feel free to reopen the issue. Thanks for report!