CPU usage constantly increasing until restart

  • Platform information:
    • Hardware: Virtual Machine running on Proxmox
    • OS: Debian 9
    • Java Runtime Environment: Version of OpenHabian
    • openHAB version: 2.2.0.1
  • Issue of the topic:
    The CPU usage is constantly increasing until restart of the Openhab service. I already increased the lovlevel but didnt find any useful information (at least not useful for me)

Is there a way for better profiling what is using the CPU so much at this time?

This is the CPU graph from Proxmox for this machine:
https://solarisproject.de/paste/?797ed24fa73a71ae#9IM8YoO+ACLKyfWktUQuYUv+n7LHH9FrKw1cDuWOBRg=

This is the process which uses so much CPU currently:
https://solarisproject.de/paste/?6d674186a01fa938#uzaNTsqoRHvYCH/ixmKis6yBrfBtajFNbKzZ4ILg3V8=

Thank you very much for your help

Best regards

The cause is one of two things:

  1. Rules that have a feedback causing an infinite loop
  2. A bug in a binding

You can eliminate 2 by systematically removing add-ons one by one until the CPU usage stops growing. Given that 2.2 has been out for almost half a year, the likelihood of this being the problem is relatively low.

For one you need to analyze your Rules to look for feedback loops. Do you have any events that trigger rules that cause events that eventually trigger the same rule again? Look in events.log and see if there are events occurring that do no correspond with your sensors and actuators and might indicate a feedback loop.

With Java jstack command line app you should be able to dump java process thread dump (karaf can do that as well, but if I remember correctly, that dump doesn’t contain pid information). So via htop you can find the pid of thread which consumes most of the CPU. And with jstack you can get information which openHAB thread it is. To get jstack dump you need to give openHAB main process pid as parameter (most probably not same as pid which consumes most of the CPU).

Beware that htop shows pid in decimal number and jstack in hexdecimal (nid).