OpenHAB 4.1.1 hangs when restarting

Hi,
I’m running OH since 3.x for a couple of years, and recently after upgrading to 4.1.1 I’m fight with a very strange problem. It is not necessarily something introduced by 4.1.1 but I haven’t seen such behaviour in the older versions. The symptom is that when I restart OH, it always get “stuck” with roughly half of Things/Items initialised, however it doesn’t continue to load the rest even after hours. If I remove tmp and cache folders, it will start normally and running fine until next restart. My gut feeling is that something fails during initialisation, maybe related to a particular binding, and below is what I observed:

  • When it hangs, events.log will not show any update from any item
  • When it hangs, the openhab.log will not output any update from rules on INFO level
  • Basically nothing works when it hangs during initialisation except for UI

I suspect there is some conflict in classpath which prevent OH to start normally, however with very little info from the log file I cannot track down the issue. The only change that could affect classpath recently is to install community version of Tesla binding (the official one stops working). However I made absolutely sure I have removed the official version before putting the jar in the addons folder.

I’d like to ask for some help from the community any good way to troubleshoot the issue like this?

Thank you in advance!

Did you update your server to bullseye and jdk to version 17 before the update?

Hi, thanks for your reply!
I use the official OH docker image so I think I have all dependencies at the right versions.

No. :slight_smile: openhabian-config will not take care about the os version, so if you are still at buster, you won’t get Java17.

Ok, thanks for the reply! I just checked and looks like I’m on JDK 17:

[~] # docker exec -it OpenHAB java -version
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+9-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 17.0.9+9-Debian-1deb11u1, mixed mode, sharing)

And which version is your os?

cat /etc/os-release

This is what I got:

[~] # docker exec -it OpenHAB cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

It’s a recent issue not sure if anything to do with 4.1.1, but I run the same setup just different version of OH images from official docker repo. I started to notice this issue until past couple of weeks.

Maybe increasing EXTRA_JAVA_OPTS="-Xms400m -Xmx800m“

Thanks for the suggestion but I don’t think it’s memory issue - it never crashes but just get stuck somewhere (I cannot tell based on log). I have reserved 2GB memory for the container so it should be plenty, doesn’t Java throws OutOfMemoryError when it fails to allocate memory? And I assume in such case the container will be restarted?

Stop OH and start it manually. Do you get any additional information?