Rule engine does not start after openhab restart due to high amount of rules

EDIT: I copied over all the additional global variables (15) to the working rule file and I could NOT get it up and running again. I believe it MAY have to do with the number of global variables in a rule file for me. 453 global variables work for auto starting the rules engine and 468 global variables does NOT get the rules engine to auto start.


I just had this happen, luckily, I had an older version of the rule file to go back to and it came up just fine. I upgrade to 4.3.0 in January, this has never happened until today.

Someone mentioned they thought it was the number of rules, I have 349 in a single file so that shouldn’t be it.

I did do a mass change creating lots of global variables to reduce duplicate local values across the rule file yesterday using Notepad++ over an SMB on a Pi4, like I have always.

I’m now comparing the files (WinMerge) and applying these mass changes again to the working rule file to see if it breaks again. My services.cfg looks like this, hasn’t changed since OH2.5.

folder:items=items
folder:sitemaps=sitemap
folder:rules=rules
folder:scripts=script
folder:persistence=persist
folder:things=things

# Thread increases from OH3 used
threadpool:thingHandler=50
threadpool:discovery=20
threadpool:safeCall=50
threadpool:ruleEngine=50

# Start level definitions
startlevel:20=dsl:items,managed:item,dsl:things,managed:thing,managed:itemchannellink,dsl:persist,managed:metadata
startlevel:30=persistence:services,persistence:restore,automation:scriptEngineFactories
startlevel:40=dsl:rules,managed:rule,rules:refresh,rules:dslprovider
startlevel:50=ruleengine:start
startlevel:70=dsl:sitemap
startlevel:80=things:handler

# Auto-update event behavior
org.openhab.autoupdate:sendOptimisticUpdates=true

Just a heads up for anyone who runs into this issue; after upgrading my openhabian to version 5.0.2 i also noticed the rule engine not starting. However i don’t think it has anything to do with the number off .rules files there are - i have only one. All my other rules are managed through the UI. The workaround offered here Cleaning up the startup process / renaming rules (windows possible) works prefectly, but apparently the root cause still exists.

I think it is a timing / timeout issue. After upgrading to an Rpi 5 I do not have the issue anymore as the rules are loaded much faster.

It’s got nothing to do with speed and/or the amount of code to be parsed and probably not even limited to rules. Happened to me on things and items, too.
Seems some files just aren’t processed. If you move them away and back, everything settles.

If anyone could come up with a full-blown startup log with the problem showing up and org.apache on debug loglevel, please create a Github issue in openhab-core.