After reboot part of rules not working

  • Platform information:
    • Hardware: x86_64/16GB RAM
    • OS: Debian buster
    • Java Runtime Environment: openjdk 11
    • openHAB version:openHAB 3.1.0.M3

Hey everyone,

since migrating to openhab 3, I’m having a very strange problem:
After every reboot some of my rules not working. I’m getting various errors.
But the strange thing is: if I open the rule file, just add or remove a space: everything is working again.

Does that sound familiar to one of you?

I’m pretty sure it has to be with my setup.
Maybe, Openhab is using a old version of the rules?

Thanks

_david

what do you mean by “not working”? All of them or just those with specific triggers ?

Enable OH debug via Karaf console to determine if rules are executed. Put debug output lines as first action of any rule.

PS: openjdk is not recommended. As you are on Debian, use openHABian.
PPS: and stop rebooting, no need to.

Hey Markus,
thanks for feedback.

Not working means I am getting errors like: “Script execution of rule with UID ‘shutter-8’ failed: index=0, size=0 in shutter”.

That happened a lot after upgrade to openhab 3. After a while, I fixed most of them. I am using a separate logger for debugging my rules. I already added some debug lines at all of these rules that was necessary when upgrading to openhab 3 to find my errors. All the triggers are fine, but the execution stocks in some point. Again, when I open the rule file add or remove a space, everything is back to normal operation and there are now further error executing the rules.
It looks like openhab is using an old version of some of the rules, instead of using the current ones?

Thanks for advice with openjdk I will look forward to move to Azul’s Zulu JVM, but I do not think that this is causing my problems.
As I am not using a raspberry pi and I am using my server not only for openhab: openHABian is not an option.
Of course, I need to reboot my server as much as I want and I want to have my system reboot safe.

No, there is no such thing, only ever one active rules file.
I guess you didn’t comprehensively fix your rules to work with OH3.
When you change a rules file that’ll trigger a reinitialization. If there are no errors there it works with the initial set of variable values and item states, but as these change in operation at some later stage, you end up in a state that your rules cannot handle properly and start seeing those errors. Use debug output lines to find the line in the code where it stops excuting the rule, output item states and variables and find the remaining errors in your code.

openHABian runs on x86 Debian, too. Use manual installation, it’ll coexist with the rest of your server.

Thx,

but if there’s a error in the rule, why is is working as soon as I change the file again?
I mean if there is a error, that error is not fixed just with adding a simple space.

Read my answer more carefully.

“Stuff outside of the rule that was not ready when the rule was first loaded, may become ready later.”