Page 1 of 1

SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 24th, 2020, 10:16 pm
by RomMon
SabNZB 2.3.9
LibreELEC 9.2.6 (only python 2)
Kodi 18.9.0 (Leia)
Python 2.7.16


I'm monitoring the used memory for some weeks on my LibreELEC HTPC with Kodi.
After using SabNZB two nights ago the memory usage of Python jumped from arround 13% to 31% and doesn't go down.

Memory before using SabNZB (see PID 608):

Code: Select all

Dumping top -o +%MEM | head -n 20
================================================
- 13:59:44 up 21 days, 11:42,  2 users,  load average: 0.33, 0.20, 0.15
Tasks: 119 total,   1 running, 118 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.5 us,  2.9 sy,  0.0 ni, 95.6 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    747.9 total,     37.4 free,    335.2 used,    375.2 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.    336.4 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND    
22745 root      20   0  654480 165088  20648 S   6.2  21.6 610:17.73 kodi.bin   
  608 root      30  10  342040  96564   1172 S   0.0  12.6 273:37.69 python     
  343 root      20   0  150312  21048   4428 S   0.0   2.7 108:25.71 tvheadend  
Memory after using SabNZB (see PID 608)

Code: Select all

  Dumping top -o +%MEM | head -n 20
================================================
- 14:03:18 up 26 days, 11:46,  2 users,  load average: 0.22, 0.21, 0.17
Tasks: 119 total,   1 running, 118 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.5 us,  2.9 sy,  0.0 ni, 95.6 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    747.9 total,     44.9 free,    493.9 used,    209.1 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.    179.9 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND    
  608 root      30  10  608612 235412   2312 S   0.0  30.7 368:49.57 python     
22745 root      20   0  714548 197052  24108 S   0.0  25.7   1794:21 kodi.bin   
  343 root      20   0  150460  18224   1060 S   0.0   2.4 210:40.03 tvheadend  

Code: Select all

 # ps -ef | grep python
  598 root      7:33 python
  608 root      6h08 python /storage/.kodi/addons/service.sabnzbd/sabnzbd/SABnzbd.pyo
 1004 root      0:00 grep python

The issue looks a bit like a thread with title "Memory leak?"

I do have an image if the memory usage, but as a new user I'm not able to insert it yet.

[edit 2020-12-26]
Restarted Sabnzb (systemctl restart service.sabnzbd.service), and now it dropped to 5%.

Image

[/edit]




Merry Christmas everyone

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 26th, 2020, 6:05 am
by safihre
You are running a very old version of SABnzbd, please update to 3.1.1.

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 26th, 2020, 7:16 am
by RomMon
@safihre thanks for your reply.
I'm running SabNZB on LibreELEC 9.2.6 (the latest released version), which is python-2 only.
I understand there is no development effort put into SabNZB 2 anymore.

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 29th, 2020, 6:18 am
by shypike
Indeed development of SABnzbd for Python 2.7 has stopped.
Also because support of Python 2.7 itself has stopped and support of required packages is dropping fast.
The memory issues may very well be caused by the Python2 of your platform.
It should be possibly to install Python 3.8 on LibreELEC.
I installed it recently on Rasbian using a blog article I found through Google.

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 29th, 2020, 9:27 am
by RomMon
@shypike thanks.
I will have to wait for LibreELEC 10 which will (only) support Python3.
Until than I will have to monitor memory usage and restart SABnzbd if needed.

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 30th, 2020, 9:41 am
by brokenr1bgolfer
After three nice years of using SABnzbd I have hit a memory leak:

Levovo Laptop 64G RAM
Lates SABnzbd version
Windows 10 Pro
All paths to NFS V4 share on QNAP NAS (I am betting that this is the problem. Had to switch from SMB because of a QNAP bug.)

Sadly my solution is switching to NZBGet. Not that NZBGet is a bad idea because it does not have the same problem, but I like SABnzbd.

Many thanks to the developers of this product. I might switch back if the issue is resolved. If you would like me to send any logs and/or data please just let me know. It is the least I can do.

Mark

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 30th, 2020, 10:23 am
by safihre
brokenr1bgolfer: this is not very helpful, you don't give any details.... How can we possibly fix it??
What kind of leak do you see? When does it occur?

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 30th, 2020, 10:31 am
by RomMon
@brokenr1bgolfer

Be aware that my issue is on a RPi3 with only 1GB RAM, and stuck at SABnzb 2 due to the use of LibreELEC which doesn't support Python-3 yet.
I was monitoring my memory usage because of Kodi crashes, and noticed this memory issue.

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: December 30th, 2020, 12:18 pm
by OneCD
brokenr1bgolfer wrote: December 30th, 2020, 9:41 am After three nice years of using SABnzbd I have hit a memory leak:

Levovo Laptop 64G RAM
Lates SABnzbd version
Windows 10 Pro
All paths to NFS V4 share on QNAP NAS (I am betting that this is the problem. Had to switch from SMB because of a QNAP bug.)

Sadly my solution is switching to NZBGet. Not that NZBGet is a bad idea because it does not have the same problem, but I like SABnzbd.
You might be better-off running SABnzbd on the QNAP instead of Windows.

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: January 8th, 2021, 7:27 pm
by RomMon
As a test I downgraded SABnzb to the oldest version available 1.1.1.
With SABnzb-1.1.1 the memory usage is much less, but also here the memory doesn't look to be released again after use.

Image

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: January 10th, 2021, 10:47 am
by safihre
I am sorry but I can't really spend time on investigating this for the Python 2 version(s)...
Things we store in memory have changed a lot over the years where we choose to keep things more in memory to aid performance, by design.
Python itself might also be the problem, but it's only worth investigating for the Python 3 version.

Re: SabNZB doesn't release it memory on RPi3b [SabNZB 2.3.9]

Posted: January 10th, 2021, 12:38 pm
by RomMon
Hi Sahihre,
Thanks for your reply! And yes that is fine.
Also indeed could be an issue external to SABnzb, and start to suspect something in that direction more and more
I see memory misbehavior with Kodi, SABnzb, and now also Plex Media Server on the RPi3 with LibreELEC 9.
The behavior of SABnzb-2 is far more obvious than the others. The behavior of SABnzb-1.1.1 is more comparable with Kodi and PMS.

Just wanted to update my findings because I'm not alone 'stuck' at Python 2 for a few more months.
Kodi v19 release (which switch to Python 3) is expected 'early 2021' with LibreELEC 10 hopefully following soon.