[Solved] Memory consumption under 7.0.0

For help and support with Universal Media Server
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Nadyita
Posts: 3
Joined: Sat Mar 31, 2018 6:03 am

[Solved] Memory consumption under 7.0.0

Post 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:
gideond
Posts: 16
Joined: Mon May 23, 2016 9:44 am

Re: Memory consumption under 7.0.0

Post 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.
gideond
Posts: 16
Joined: Mon May 23, 2016 9:44 am

Re: Memory consumption under 7.0.0

Post 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.
Nadyita
Posts: 3
Joined: Sat Mar 31, 2018 6:03 am

Re: Memory consumption under 7.0.0

Post 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.
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: Memory consumption under 7.0.0

Post 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
Nadyita
Posts: 3
Joined: Sat Mar 31, 2018 6:03 am

Re: Memory consumption under 7.0.0

Post 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)
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: Memory consumption under 7.0.0

Post by boss »

Glad it worked.
I was thinking the same about the V7 UMS.conf file as well. Strange.
User avatar
SubJunk
Lead Developer
Posts: 3705
Joined: Sun May 27, 2012 4:12 pm

Re: Memory consumption under 7.0.0

Post by SubJunk »

Would be good to get some logs so we can fix this :)
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: Memory consumption under 7.0.0

Post 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.
Attachments
debug V7.zip
(3.8 MiB) Downloaded 430 times
User avatar
SubJunk
Lead Developer
Posts: 3705
Joined: Sun May 27, 2012 4:12 pm

Re: Memory consumption under 7.0.0

Post 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.
Post Reply