Huge CPU Load - Zulu8 on Mac OS X - sporadically

  • Platform information:
    • Hardware: Mac Mini OSX 10.14
    • OS: what OS is used and which version
    • Java Runtime Environment: Zulu 8
    • openHAB version: 2.5 (latest milestone)

Hi!
I created a System Widget with Habpanel to monitor my setup. I measure the power consumption as well as the CPU load. I recognized that pretty often my power consumption doubles or even more although the macmini is “only” running openhab and teamviewer for maintenance reasons. i opened the activity monitor to see what’s going on and java proces wass at 150% cpu load for hours until i decided to restart the system.
Unfortunately i have no clue how i could identify the problem - maybe it’s a faulty binding (i only installed the sony devices binding manually) or what else could be responsible …

Now i have the issue again.
Power consumption from 12,5 W (yesterday after restart) up to 27,5 W right now.
Java is going crazy in the system activity monitor.

I tried upgrading to the Milestone 3 and latest Zulu8 and still got this issue …
Can someone poke me in the right direction on what to investigate?
Thank you!

Hello.

i am still suffering from this issue.
i called
ps auxwww
and this is what i get:

USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
jonas 236 83,9 5,1 8973748 536472 ?? R Mo02pm 123:56.56 /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java -Dopenhab.home=/Users/jonas/openhab2 -Dopenhab.conf=/Users/jonas/openhab2/conf -Dopenhab.runtime=/Users/jonas/openhab2/runtime -Dopenhab.userdata=/Users/jonas/openhab2/userdata -Dopenhab.logdir=/Users/jonas/openhab2/userdata/logs -Dfelix.cm.dir=/Users/jonas/openhab2/userdata/config -Djava.library.path=/Users/jonas/openhab2/userdata/tmp/lib -Djetty.host=0.0.0.0 -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=0.0.0.0 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -XX:+UseG1GC -Djava.endorsed.dirs=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/endorsed:/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/lib/endorsed:/Users/jonas/openhab2/runtime/lib/endorsed -Djava.ext.dirs=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/ext:/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/lib/ext:/Users/jonas/openhab2/runtime/lib/ext -Dkaraf.instances=/Users/jonas/openhab2/userdata/tmp/instances -Dkaraf.home=/Users/jonas/openhab2/runtime -Dkaraf.base=/Users/jonas/openhab2/userdata -Dkaraf.data=/Users/jonas/openhab2/userdata -Dkaraf.etc=/Users/jonas/openhab2/userdata/etc -Dkaraf.log=/Users/jonas/openhab2/userdata/logs -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/Users/jonas/openhab2/userdata/tmp -Djava.util.logging.config.file=/Users/jonas/openhab2/userdata/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /Users/jonas/openhab2/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.2.6.jar:/Users/jonas/openhab2/runtime/lib/boot/org.apache.karaf.jaas.boot-4.2.6.jar:/Users/jonas/openhab2/runtime/lib/boot/org.apache.karaf.main-4.2.6.jar:/Users/jonas/openhab2/runtime/lib/boot/org.apache.karaf.specs.activator-4.2.6.jar:/Users/jonas/openhab2/runtime/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

I can’t see anything problematic here.
After that i followed the following guide:
https://backstage.forgerock.com/knowledge/kb/article/a39551500

and what i get is a huge list.
Unfortunately I also don’t know what i am searching for :frowning: i am a bit lost and would appreciate help very much!

I tried to identify the time stamp when this happens and checked the openhab.log and event.log as well as the computers system log files but could not find anything suspicious …

EDIT: Seems like i cannot access the karaf console via

ssh -p 8101 openhab@localhost

anymore now. I think that might have something to do with that issue …
Should i create a bug report on Github? I did never do that and don’t know which data to provide. do you think my logs are sufficient?

No what you give is absolutely not sufficient. Noone can help you there as long as you don’t provide more insight because it is not a well known problem to occur everywhere.

So there is something specific you did or do to cause this, and that in turn noone but you can know.

You need to find out yourself. Do a strace() [or however that’s called on MacOS, I don’t know] or use a Java profiler to find out what Java does in that state.
Migrate to openHABian on RPi to see if it happens there, too.
Delete the cache.
Setup OH again from scratch.

Enable debugging for rules processing (read the docs about logging and start with log:set debug org.eclipse.smarthome.model.script and extend to org.eclipse.smarthome or org.openhab if that does not give any hints).
If something on your box changes any of the source items or rules files, this results in a lot recompilation, making java CPU jump to 100+%. The aforementioned logging level would create log lines in that case to give a hint).
Maybe you yourself edit files in place or your editor works that way (intermediate saves?).

But please stop writing posts expecting someone to take you by the hand and debug the thing for you.
That won’t happen. Es gibt hier nur Hilfe zur Selbsthilfe, und MacOS benutzt halt kaum jemand.

1 Like

Thank you for your hints. I will try that i am happy to help myself but i did not know where to start. I will try to look at the logging after enabling debugging and if that does not help i will start from 0 and install one binding after the other to see what’s going wrong. i don’t know if mac os is the main issue but we will see :slight_smile:

Hello

just a little update.
I activated the debug modes you suggested and could not find anything suspicious in the time slot the cpu load went up so i tried to analyze the java threads - i am just not skilled enough to dig that deep or lets say i won’t find out which thread is suspicious because i do not know what to look at.
There is no CPU load bar next to the threads only a state (running, sleeping park).

So I started from scratch and added half of the bindings first and i did not have the problem for days. I added one binding after another to see if the problem occurs again but everything seemed fine. Now i have the issue again and I will start over again with an even longer wait time between the additions to confirm functionality. Can you provide a link to a tutorial on how to use java analyzers? I am using VisualVM at the moment, read a lot but did not make any progress.

I had no rules added to my config and excluded the OpenHAB folder from system search and backup (in case of the OS doing something with the files).
I also switched from Zulu8 to the Java 8 Oracle version But the problem still occured.

I will now try to go back to OH 2.4 and i ordered a raspberry pi to see if the problem comes from the OS.

Hey guys,

i thought i got rid of that behavior because my machine was good for more than 2 weeks but i did not as it turns out.
maybe i should try running a virtualbox with openhabian in it …
for now i am rebooting daily as i cannot see where the problem comes from.
even a friend of mine (software developer) could not help me while trying to investigate for hours.
java seems to be a bitch :wink:
but yeah - maybe it’s a mac os specific thing. I hope i’ll get this fixed with the vm.

I created a virtual vm with ubuntu server and now i don’t have the issue anymore … i cannot see where it came from but i am happy now :wink: