How to find the cause of a OutOfMemoryError in OH2?

@OMR :smiley:

did you already report an issue?

No, haven’t had the time to follow up on it.

Did closing the browser tab fix it for you too?

@OMR i rebooted before closing :slight_smile: :frowning:

Can you please double check whether you’ve installed the following addon?

openhab> feature:list | grep Front

openhab-binding-fsinternetradio | 0.9.0.b2 | x | Started | openhab-aggregate-xml | Frontier Silicon Internet Radio Binding

This addon creates in my environment (OH2, 2.0.0.b5) permanently new threads called HttpClient until the System runs OOM.

You can easily check this by calling dev:dump-create and check amount of threads in threads.txt (1st line)

1 Like

for sure not…

my add-ons are this ones:

Can you check this (@karaf):

shell:threads | grep HttpClient | wc -l

currently 41

update: i had several OutOfMem’s, but since i added the -XX:+HeapDumpOnOutOfMemoryError : none…

Not sure if this is got or bad :slight_smile:

Did this actually solve your issue?

It doesn’t solve memory leaks. :wink: It just creates a (.hprof) file containing a memory heapdump whenever it runs out of memory. That way you can analyze the memory contents in a program like Eclipse MAT.

Of course not. :smiley:
When I have the dump - I will try to undestand it and will (definitely) come back with questions…

One more rookie question.

Would it help to remove the bindings one by one to see if OH is coming back to life?
(I still get log entries in openhab.log every now and then)

If your whole OH doesn’t work at all, I think the OutOfMemoryError is just a side effect of some other issue.

If OH works fine for a couple of days and than crashes due to the OutOfMemoryError you can remove some bindings to find which binding is causing this. This will only work if the memory leak is caused by a binding. It could be anywhere, e.g. Eclipse SmartHome or your rules. Without analyzing the heap dump you are basically searching for a needle in a haystack.

Alright, thanks.
I though it might be worth playing around, but for activating the heapdump parameter in /etc/default/openhab2 I need to restart anyway…

Good! And always try updating to the latest SNAPSHOT release which should have all known memory leaks fixed. With the SNAPSHOT release you’ll only experience new and unknown memory leaks. :wink:


I just got another memory leak and a java… file has been created.
So what to do with it?
for me it looks like crap :wink:

JAVA PROFILE 1.0.1^@^@^@^@^D^@^@^Af¦/e^Z^A^@^@^@^@^@^@^@-`I<83>^X(II)Ljava/time/temporal/TemporalAdjuster;^A^@^@^

Checked with Eclipse MAT:

But how to proceed from here?

It looks like there is some kind of memory leak in the sitemap events mechanism.

If Eclipse MAT shows the same “Problem Suspect” with recent openHAB 2.4.0 builds, we should create an issue for this so it is solved in Eclipse SmartHome.

hmmm… sitemap… I don’t use any sitemap since I switched to HABpanel…!?

HABpanel is using the same Server Sent Event (SSE) mechanism to get notified of updates like Basic UI and Paper UI. According to the heapdump analysis it was consuming more than half of all the memory used by openHAB. Was that heapdump made with openHAB 2.4.0? Do you have a lot of devices running HABpanel?