[Solved] Rules stop triggering after some time

Dear community,

with the availibility of Oh2.5.6 I migrated from a RPi2 to a Docker based setup running on a Synology NAS (DS 720+, 4 Cores, 18 GB RAM).

Although I had some struggels with the container setup, everything worked fine for a time.
After upgrading to OH 2.5.7 rules stopped triggering after 1-3 days.
The logs showed nothing unusual.
Re-Creation of the container usually solved the issue, but this is not really satisfying.
After Upgrading to OH 2.5.9 rules stopped triggering after 4-16 hours.
Again nothing appeared in the logs.
Downgrading to OH 2.5.7 changed back to runtimes about 1-3 days before the rules stopped working.

It does not matter, if rules should trigger at a change of luminance, manually triggered switches or cron-based rules. Everything just stops working.
Looking in the logs, events are still beeing received, just not processed.

I also searched the docs and found plenty of issues which sound similar, but are not matching my situation.

Example:
a rule to determine if it is dark or light outside.
Based on this information, garden lights are changed to ON or blinds are moved up or down.

rule "toggleBrightnessLevelOutdoor"
when Item brightnessOutdoorSouth changed
then

    if (brightnessOutdoorSouth.state < 135 && brightnessLevelOutdoor.state == 1 
		    || brightnessOutdoorSouth.state < 135 && brightnessLevelOutdoor.state.equals(NULL))    {
	    	        sendCommand(brightnessLevelOutdoor, 0) //dark		
	        //	logInfo("rule", "- Outoor Brightness "+ brightnessOutdoorSouth.state+ ", Switcht 
brightnessLevel to 0 / dunkel ")		

	    } else if (brightnessOutdoorSouth.state >= 145 && brightnessLevelOutdoor.state == 0 
	    	|| brightnessOutdoorSouth.state >= 145 && brightnessLevelOutdoor.state.equals(NULL)
    	) {		

	    //	logInfo("rule", "- Outdoor Brightness "+ brightnessOutdoorSouth.state+ ", Switcht 
brightnessLevel to 1 / hell ")
	    	sendCommand(brightnessLevelOutdoor, 1) //light	
    }

end

The log still shows the ItemChanged event, but the rule does not trigger
[vent.ItemStateChangedEvent] - brightnessOutdoorSouth changed from 194 to 195

The rule above is just one of many rules which stopped triggering and have workd for years earlier.

Any idea or hint to figure out the root cause of this?
I try to figure out the roout cause of this, but after weeks without success, and days between the occurences, I start to go nuts…

Start at Why have my Rules stopped running? Why Thread::sleep is a bad idea

@rlkoshak
thank you for the link.
Although I have not a single Thread::sleep in the whole cose, I suspect I have to review the hole stuff again and be on the lookout for long running rules.

Check that you are not running out of rule engine threads.

After checking the code against the mentioned criteria and increasing the threadpool, everything works fine again.
Thank you for your immediate support.

1 Like

hi guys,
in my case something similar poped up, I changed nothing for months - I treat it as prod system. Suddenly after few days after restarts rules stoped to work, later restart help for less than 24hours yesterday even restart was not helping.
I was going throu all suggestion, but I found one thing, it is not like rules are not working - they are working, but persistence addons somehow blocks items state - and rule works but do not get event about item states changes - i temporarily disabled all persistance addons and system works again. I have no idea why persistance has issues… space is there, ram is there, inodes is there - no idea. Putting this answer to let others that it might be just looking like rules are not working (in fact this part of code is doing nothing :smiley: )