Page 1 of 2

[Solved] Memory consumption under 7.0.0

Posted: Sat Mar 31, 2018 6:11 am
by Nadyita
Hey all!

I just upgraded from 6.8.0 to 7.0.0 and the server kept throwing these:

Code: Select all

INFO  17:07:25.649 [Thread-7] Exception in thread "Thread-7" java.lang.OutOfMemoryError: Java heap space                         
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "MVStore background writer nio:/opt/ums/.config/UMS/database/medias.mv.db
INFO  17:07:38.411 [JmDNS(36720b1580dd.local.).Timer] Exception in thread "JmDNS(36720b1580dd.local.).Timer" java.lang.OutOfMemoryError: Java heap space
ERROR 17:07:38.411 [Library Scanner] Error adding child: "08 - Musik + Ansage.mp3"                                               
java.lang.OutOfMemoryError: Java heap space                                                                                      
all the time. I then gradually increased heap memory to 6GB and now it seems to run, but constantly consumes 6GB of memory. I tried activating the garbage collection and now my command line looks like this:

Code: Select all

java -XX:PermSize=512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 \
-XX:InitiatingHeapOccupancyPercent=70 -Xmx6096m -Xss2048k -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djna.nosys=true -classpath ums.jar net.pms.PMS
The database folder is also 6GB in size, so I was wondering if that's related to each other? The 6.8.0 version only consumed roughly 1GB of memory, but not 6GB. Is there anything I can do to lower the consumption? I only have 8GB in that machine :shock:

Re: Memory consumption under 7.0.0

Posted: Sat Mar 31, 2018 1:35 pm
by gideond
Mine is acting up since the upgrade to V7 as well. I have the default memory setting, which is somewhere around 1GB and it's breaching that during the initial startup scan. When this happens it does not release that memory even if it is done scanning. It just stays pegged slightly past the max. Task Manager shows the java process using over 1500 MB. I can stream music when this happens, but if I try video it just crashes the server. Happening on multiple machines for me.

Are you by chance patched against Meltdown and Spectre? I install the MS Spectre patch last weekend. I swear I was using it Monday without issues though.

Re: Memory consumption under 7.0.0

Posted: Sat Mar 31, 2018 1:44 pm
by gideond
Okay, some progress. I've now negated the problem on all systems affected by it. Go into your navigation/Sharing tab and untick the "Enable the Media Library" option. Close and reopen the program. See if the issue has gone away. Apparently this is a caching issue involving the Media Library function. I had caching issue a lot like this when the upgrade to V6 happened. I had to disable caching for a few versions until it was sorted. I'm guessing this must be a regression.

Re: Memory consumption under 7.0.0

Posted: Sat Mar 31, 2018 9:23 pm
by Nadyita
That's good news. I'm running on Linux in headless mode though, so nothing to to with Windows Spectre patches for me.
What is the setting named in the config file? I have set

Code: Select all

hide_media_library_folder = true
before, but that didn't seem to have suppressed it. Also UMS shows the transcode folder although it was and still is disabled in the config file.

Re: Memory consumption under 7.0.0

Posted: Sat Mar 31, 2018 10:02 pm
by boss
In V7 (UMS.conf) some of the commands have been changed.
Prior to V7 they were hide = true. Now they are show = false.
So to hide the transcode folder try changing:
hide_transcode_folder = true
To
show_transcode_folder = false
Also in V7
hide_media_library_folder = true
Becomes
show_media_library_folder = false

Re: Memory consumption under 7.0.0

Posted: Sat Mar 31, 2018 11:50 pm
by Nadyita
Thanks, that did it! But why does the UMS.conf that ships with 7.0.0 only contain hide_* default and not show_* ? Weird. Anyway… glad it's working now :o) My children thank thee ;o)

Re: Memory consumption under 7.0.0

Posted: Sun Apr 01, 2018 2:54 pm
by boss
Glad it worked.
I was thinking the same about the V7 UMS.conf file as well. Strange.

Re: Memory consumption under 7.0.0

Posted: Mon Apr 02, 2018 1:59 pm
by SubJunk
Would be good to get some logs so we can fix this :)

Re: Memory consumption under 7.0.0

Posted: Mon Apr 02, 2018 5:17 pm
by boss
In V7 I was getting a java heap space error quite quickly.
I modified this cache setting in UMS.conf to:
use_cache = false

And now it does not seem to be happening.
The log (In TRACE mode) is attached from when it was happening.

Re: Memory consumption under 7.0.0

Posted: Tue Apr 03, 2018 5:15 pm
by SubJunk
Thanks boss, it seems to be related to a lot of images being processed and it probably would have been a bug for a long time but didn't get noticed until we made UMS do the scan on startup. It looks like we need to work on freeing memory during the scan. I will make an issue for it on our tracker.