Upgrade OH 4.0.0 -> 4.0.1 high cpu usage

  • Platform information:
    • Hardware: intel N100/ 16GB
    • OS: Windows 11 Pro
    • Java Runtime Environment: Azul 17.0.8+7-LTS
    • openHAB version: 4.0.1
  • Issue of the topic: After upgraded from OH 4.0.0 to 4.0.1 CPU usage increased to almost 100%, after downgraded to 4.0.0 CPU usage is around 5%-20%. I’m curious if it is only my issue or global.

Hey @604435

I have the same problem after the upgrade :-/

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                                                                                                             
  795 openhab   20   0 1120684 400792  11948 S 365.4  10.2   2:06.17 java   

Regards,
Tim

Reporting the same issue. This has been an ongoing problem for me. I first upgraded to OH4 when M1 first got released in early March 2023. I enjoy helping and figured I’d test the new version. I immediately began to have problems with the cpu going over 100% causing the host to get very sluggish. The Host is a small Dell brand desktop running Mint Linux with I3, 8Gbs Ram and 1Tb spinning HD so not a rocket, but not a Pi. It does very little other then run openHAB.
I reported the issue in the snapshot discussion thread here and also found another thread that seemed similar to the problems I was having. I figured it was unique to my setup because no one else seemed to be reporting similar problems.
Eventually I thought I had found the culprit as being a rule which had a syntax error. I disabled the rule in question and the problem subsided but didn’t go completely away. I have since occassionely still had the same. I continue disabling other rules, my system has been crippled for months. I’m not surprised to see this thread because I always felt there was a more underlying issue then just my rules having a syntax error.

Just upgraded to 4.0.1 and everything looks fine. Platform information:

  • Hardware: Shuttle Inc. DH32U (32G RAM, CPU: Intel(R) Pentium(R) Gold 7505 @ 2.00GHz)
  • OS: Ubuntu 22.04
  • JVM: OpenJDK Runtime Environment Zulu17.44+15-CA (build 17.0.8+7-LTS).

Side note: After ~10 minutes, the load on the Pi is perfect.

I did more tests. This issue in my case also occurs on OH 4.0.0. On Both (4.0.0. and 4.0.1) it happens not every time. Sometimes it happens 3 times on row and then 7 times are fine. I’m still investigating it.

I didn’t find any unusual (checked different version of Java Oracle/Azule, started OH from console/ services, disabled other programs). I can’t reproduce it. It happens randomly. Maybe due to some lags durning loading modules and modules are not loaded in proper order. For me it is very strange. Finally I have reverted back to OH 3.4.4 and Java 11. When I have more free time I’ll back to tests.

I have similar issues, couldn’t narrow down the problem (I still think the queuing is the issue). At this stage OH4 is in my perspective still in a beta stage. I’m back to OH3.4 and Java 11. I hope sincerely, the issues will be solved with future updates and will will get a similar stable framework as it used to be.
Thanks a lot for all efforts
Florian

Perhaps this helps a little bit for all the JS integrations: Infrastructure: Disable Webpack TerserPlugin for cached globals injection by florian-h05 · Pull Request #283 · openhab/openhab-js · GitHub & [jsscripting] Upgrade openhab-js to 4.5.1 to fix cached injection (#1… · openhab/openhab-addons@bf7f24c · GitHub Current state is “ok” for me, but I hope it will be faster in the future again.

So you mean that the high CPU was due to JS scripting?

Perhaps. And I hope so :slight_smile: I have many JS rules and the rules run very long currently. E.g. only 1-2 blocks in Blocky and the rule is ~10 sec on “running” state.

I don’t use JS.

I also don’t use JS scripting
I use Jruby and DSL all UI based rules, no file configuration of anything

Just as an idea, maybe it is related to Azul Java? I am using Oracle OpenJDK and CPU usage is at 0.1%

1 Like

andy@Treehouse:~$ java -version
openjdk version “17.0.7” 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Ubuntu-0ubuntu118.04)
OpenJDK 64-Bit Server VM (build 17.0.7+7-Ubuntu-0ubuntu118.04, mixed mode, sharing)

Just to maybe confirm things. I do use JSscripting (both old and new) in 20 rules and experience no CPU issues. Before the update it was just below 10%, and after also.

Hardware is a Raspberry 4, allocated 1gb for openHAB.

You also seem to have Oracle OpenJDK installed but there is a server component installed

This is how it is on my device (just identifying differences, without really understanding the meaning)

…:~ $ java -version

openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Raspbian-1deb11u1rpt1)
OpenJDK Client VM (build 17.0.7+7-Raspbian-1deb11u1rpt1, mixed mode, emulated-client)
…:~ $ java -XshowSettings

VM settings:
    Max. Heap Size (Estimated): 247.50M
    Using VM: OpenJDK Client VM
    …
    java.specification.vendor = Oracle Corporation

Hello Guys

upgrade/migration worked.

java now use all processor usage. I use openhabian on ubuntu.

Cheers

Jacob

I tested both Java Azul and Oracle. Both the same issue.

Thanks for testing this.