Java 'OutofMemory' error crashes - please help!

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
Triplefun
Posts: 136
Joined: Sat Jun 02, 2012 2:29 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by Triplefun »

Many thanks for your assistance. I installed your updated program but it kept crashing. Note although I have 2 LG TVs on my network, I don't use them as DLNA clients. I do have a LG DVD player (BP240). The latest 6.6 release seems to be a bit more stable and I notice it includes an LG WebOS update. My main playback devices are a PS3 (wired), Panasonic TV (wireless), Sony 7200 (wireless), and the LG BP240 (wireless). My default renderer is the PS3. It would be nice to disable some of the devices since there are lots of other DLNA clients which are not used and only clutter the UMS logs.
User avatar
Sami32
Posts: 851
Joined: Mon Apr 11, 2016 5:09 am

Re: Java 'OutofMemory' error crashes - please help!

Post by Sami32 »

Triplefun,

In the "General configuration" tab, click on "Select renderers" and selct "Deselect all renderers".
And finally, choose only the one that you need.

Please, next time that you post a log, use TRACE mode and not ERROR mode, as explained here:
viewtopic.php?f=9&t=556

While using an official UMS version, do you get this issue if the "cache" is not enabled ?
In the "Navigation/Share Settings" tab, deselect the "Enable the cache".

As a possible workaround you can also, while reinstalling UMS without a clean install, change the memory value asked at install time to 4096.

As a side note, you are using a Java 8 32-bit version on your Windows 10 64-bit.
boss
Posts: 348
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by boss »

Did anyone find a solution to the "Java OutOfMemory" error crashes with LG WebOS TV's.
I've had this problem for a while and to date have had no solution.
jdc2389
Posts: 2
Joined: Fri May 04, 2018 8:17 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by jdc2389 »

Did anyone find a solution to the "Java OutOfMemory" error crashes with LG WebOS TV's.
I've had this problem for a while and to date have had no solution.
Same here I have an LG Oled, LG OLED55B7P. I did some very light usage and it lost it's shit and java had a memory error that was eating 98% of my 4 core cpus cycles. Yikes.
boss
Posts: 348
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by boss »

Yep, I have been having this problem through quite a few versions. UMS has some underlying problem with Java and memory leaks.
7.0.1 has been the worst for me. I can't even get 24 hours of it running without it crashing due to Java memory issues.
And that is without even using UMS. Just having it running and my LG WebOS 3.5 TV on.

The latest thing I tried was:
Just have the renderer configuration files that I need in the renderer directory.
Turn of caching in UMS.conf.
UMS seems to run for a few days before crashing if I do that.

I've posted about the issue multiple times but to date no one has really looked into the problem.
Last edited by boss on Sat May 05, 2018 12:16 am, edited 1 time in total.
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by Nadahar »

@boss That's not true, I'm convinced I know exactly what the problem is - the problem is that fixing it requires rewriting the very core of UMS. One thing you can do to make the problem grow slower is to turn off thumbnails. They are a significant part of the memory used. And by the way, it's not a memory leak - but I see how it can look much the same to the user.
boss
Posts: 348
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by boss »

@Nadahar

Thanks for the reply.

In UMS.conf I see there is:
generate_thumbnails =
and
image_thumbnails =

Is your suggestion to turn off both of these? or just one and if one, which one?

I have 2 LG-BP550 bluray players and I didn't notice the problem when I only had these renderers. Probably because I would only turn them on when I wanted to use UMS.
I started to notice the problem after I added an LG WebOS 3.5 TV. Most likely because the TV is on a lot (even when not using UMS).
My UMS is running on a Gentoo Linux headless server and UMS is running 24/7 on the server.
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by Nadahar »

If you want to keep it running for the longest, turn off both. Just to make it clear, UMS will always run out of memory eventually because it doesn't free what has been loaded into memory. The reason for this is quite complicated to solve, but it is the real problem.

To make the time it takes to run out of memory as long as possible, you can increase the amount of heap memory allocated to UMS and you can turn off what you can of thumbnails, since they are a significant part of what is kept in memory. Neither of this will keep UMS from running out of memory in the end, but it will postpone it - potentially by quite a lot.

Until the fundamental logic that makes sure it's impossible to free resources is fixed, running UMS 24/7 is essentially impossible. As a consequence, you have to arrange for some kind of periodic restart. To stop the UMS process gracefully, send "sigterm" from a script (aka "kill/killall -15"). Wait a couple of seconds and then let the script start UMS again. Run this with cron, and you have made a workaround that shouldn't cause you much problems.
boss
Posts: 348
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by boss »

@Nadahar

We spoke about the UMS with a cron job restart a few months back. I was trying to avoid it as UMS can be used here at anytime of the day or night. (3am for example).
I will turn off the thumbnails and see how it goes.

I do have Serviio (which I don't normally use) and that doesn't have any problems. I can use that but I much prefer UMS and my preference is to see this issue solved.

Thanks again.
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Java 'OutofMemory' error crashes - please help!

Post by Nadahar »

I know that we've talked about the cron job before, and I'm not saying it's an ideal solution, I'm just saying that unless the fundamental issue which cases memory not to be released is fixed, restarting it periodically is the only way to avoid UMS to run out of memory. There is nothing more anybody can do about it, there's no "bugfix" or "tweak" that can be done.

Changing the flawed logic is a huge job that I would guess would take months and a lot of trial and error. UMS simply doesn't seem to have been designed with the ability to run 24/7 in mind. I think it's a shame too, don't get me wrong. But, until somebody is willing to invest a lot of time in fixing this, it will remain the case.

When it comes to the peridic restart, it doesn't have to be every day. That all depends on how long the memory you have allocated to UMS will "last". Every 3 days might be enough, it all depends on both the use and the amount of memory. While I appreciate the point that "nothing really fits", I have an issue with my Dreambox that has to be run daily and takes a couple of minutes. After a lot of moving the time around, I've found that 11:00 (11 am if you're that kind) works reasonably well for us. You should be able to find some time when the probability of use is very low at least ;)

When it comes to Serviio, I'm not saying that this is some generic Java problem that will affect other software. It is caused by how UMS is designed to work, those that planned this never imagined that they would "run out of resources" and thus didn't make any way to free used resources. A lot has since been built on top of this, making a redesign now very challenging.
Post Reply