Java Heap Size Errors

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

Re: Java Heap Size Errors

Post by boss »

OK. Thanks

I have found that notepad or wordpad opens it OK.
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Java Heap Size Errors

Post by Nadahar »

Neither wordpad nor notepad would open the file for me, but I found a program that would (LogExpert). There's no way to go through this huge file manually, but from what I can see there's nothing out of the ordinary. It doesn't run out of memory when being idle, it does so after getting a browse request from a "LG WebOS TV".

This looks like a result of the known problem that previously browsed resources aren't released. Unfortunately there is no way to fix it without rewriting a lot of the fundamental way UMS works, so I don't know if it will ever be solved.

For now, I think the best solution is to simply restart UMS using a cron job once a day or something like that. I guess you can find a time of day where it's very unlikely to be in use that you can do a restart. If you use kill -15 (NOT -9) it should shut down gracefully. Kill won't block, it only sends a signal and doesn't wait for UMS to terminate, so you'd either have to make a script that waits until it is no longer in the process list or simply sleep for 30 seconds or something like that before starting it again.

Increasing the heap size will only let it run for longer until the problem manifests itself.
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java Heap Size Errors

Post by boss »

@Nadahar
Thanks for checking it out and the reply.

I was actually thinking about a cron job to do a restart. I will check it out further.

I have 1 x LG WebOS TV and 2 x LG BP550 blueray players that I use with UMS.
It seems to only happen if I watch a lot of movies on one of the bluray players in succession. Perhaps it would happen normally but I have probably restarted my server by the time I watch a lot of movies.

Cheers
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java Heap Size Errors

Post by boss »

@Nadahar
I'm still trying to resolve this issue without setting up a cron job to restart UMS every couple of days.
I have found out, that even if I don't play a lot of videos (or any videos) it still happens but takes a little longer.
So my assumption that playing many videos in succession was the cause was wrong.

I increased the heap size (in UMS.sh) to 1024MB and all it did was take a bit longer before the issue happened. (as you said it would).

It does seem that the LG-WEBOS 3.5 TV is causing the issue.
I have noticed that whenever the LG WEBOS TV is on (even though not using UMS), I get these messages in the log:
DEBUG 2018-03-09 21:32:55.629 [HTTPv2 Request Worker 1] Recognized media renderer "LG-WebOSTV-1"
DEBUG 2018-03-09 21:32:56.636 [HTTPv2 Request Worker 1] Recognized media renderer "LG-WebOSTV-1"
DEBUG 2018-03-09 21:32:57.641 [HTTPv2 Request Worker 1] Recognized media renderer "LG-WebOSTV-1"
every 1 second.

Is that normal behaviour?

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

Re: Java Heap Size Errors

Post by Nadahar »

That sounds odd, but the lines surrounding these lines would tell more about what kind of traffic it is.

If the issue is what I think it is, it doesn't have anything to do with playing media, it's browsing media that fills up the memory. Basically memory allocated when browsing (a lot of information about the media files plus thumbnails) is never released. You can change how long it takes by for example turning of thumbnails or increasing the heap size, but every such trick will just postpone it. As long as they are never released, it will run out of memory at some stage.

A cron job that restarts UMS every couple of days is the best solution until this problem is solved in UMS (if ever).
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java Heap Size Errors

Post by boss »

@Nadahar
Perhaps you would be good enough to take a look at my log file to see where this is happening.
I have attached the log file (not in trace mode) showing it.
For instance, on 2018-03-08 18:32:05.643 (when I turned the WEBOS TV on, the message:
[HTTPv2 Request Worker 1] Recognized media renderer "LG-WebOSTV-1"
starts and continues (looks like a log entry every 1 second) through the night. During that time, UMS was not being used.

Same thing appears on 2018-03-09.

Does it look normal?

Thanks
Attachments
debug.log.zip
(212.74 KiB) Downloaded 349 times
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Java Heap Size Errors

Post by Nadahar »

I'm afraid I need trace mode to see what the communication is about. Can you make one in trace mode where this happens?
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java Heap Size Errors

Post by boss »

I have attached the log file in "Trace" mode.
The [HTTPv2 Request Worker 3] Recognized media renderer "LG-WebOSTV-1" lines in the log file are not as frequent as when I looked at the log which was not in "Trace" mode.
They are still appearing about every 16 seconds now though.

This is when the only DLNA device turned on is the LG WEBOS TV and the TV was not being used to access UMS at all.

Thanks
Attachments
debug.zip
(17.41 KiB) Downloaded 345 times
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: Java Heap Size Errors

Post by Nadahar »

I see a repeating pattern where the LG asks for "SUBSCRIBE /upnp/event/content_directory HTTP/1.1" and "SUBSCRIBE /upnp/event/connection_manager HTTP/1.1" in intervals. I'm not sure why it keeps doing this, UMS probably doesn't give the response it wants so it keeps trying to subscribe. To figure out which party is wrong here requires studying the UPnP standard details regarding this, which I'm not up to right now. The reply UMS gives to the connection_manager request seems a bit "brief" to me (the answer doesn't contain any real information, just the standard syntax).

I can't say 100% sure, but I doubt that is related to the memory consumption. Even though they can't agree on this subscription, I can see nothing that would make UMS enumerate media entries, which is what causes the memory to fill up. I could be wrong though, that there's something I'm missing here, but I think it's "harmless".
boss
Posts: 343
Joined: Thu Jun 30, 2016 1:07 pm

Re: Java Heap Size Errors

Post by boss »

Thanks for looking at that for me.
Also this message is in the logs every 31 seconds when no devices that use UMS are switched on:
DEBUG 2018-03-11 16:50:08.775 [UPNP-AliveMessageSender] Sending ALIVE...

Do you think I should increase the interval with the "ALIVE_delay" setting in UMS.conf.

Thanks
Post Reply