openHAB 3 runs out of memory / java heap space errors, CPU 100%+ after a few hours

@Kai - Can you create an official stacked post with listed clear procedures (also for non linux experts) for these annoing issue that many many many users still to have randomly in their OH life?

  • How to give you right informations (like how to extract the JAVA thread dump)
  • Is there something special to look inside on it?
  • A list of the corrently known root causes that bring to cylcis crushes due to JAVA HEAP SPACE

I think at the moment this is the most annoying issue OH have…

Thank you in advance.
Nicola

Hi ,

Thanks for your replay @Mherwege .

that’s my output:

My heap is very stable and flushes.

my memory:

And my cpu.

uptime.

Can you guys give me any tips and help? So I can know what uses a lot of cpu? A specific binding?

Thanks!

@jelmer1 Could it be you have 2 instances of openHAB running, one as root, and one as user openhab? The root one got started at 9:13 this morning (the openhab one is running since yesterday). It is the root one that is at 100% CPU.

How can in see if there are two instances running? And can it be the carafe console that is not sealed?

@jelmer1 The karaf console indeed creates a second java openhab process. It looks then like it is an open karaf console, started as root, that is eating 100% CPU. I tried on my install. If you use openhab-cli console it will not create it as root (but user openhab). And in my case, having the console open does not spike the CPU to 100% (RPi 4). The process is also gone when I leave the console.

Hi i have rebooted my rpi4 and the java root proces is away!

Process will run under the user that starts it. In case started as root then process is owned by root.
in case started by openhabian it is owned by openhabian but because of the length of the account name it is being displaced as openhab+

I disagree, to me it is flushing back to an increasing amount and not back to the same value. See the red line is the trajectory of your trending heap size, when the green line is where a healthy heap should be going back to each time a garbage collection is done. To be 100% sure it would need more time to establish a growing trend, but it does look like it is leaking, and that is what you would expect if your getting Out of memory errors.

Based on the graph I would expect you to have an issue every 10 or so days if the memory leaks at a constant rate. I go for months and my heap does not grow.

3 Likes

Thanks for your replay! I will test and monitor everything.

I come back later.

My heap after 24hours!

No he has flushed! Thats good!!