Simple Rule breaks Rule Engine

Hello,
I have set up a rule to fire every five minutes. It is running OK for several hours, then the rule engine breaks and no rules are executed any more. Commands still work; e.g. if a press the Button, Radio Starts/stops OK, but the Button which triggers the rule to change the Radio Station send it’s command, but the rule does not fire. I need to remove the rule and Stop/Restart OpenHAB for things to work again. Tried this several times and can drill it down to that rule. Maybe I am missing the obvious, but i can not see anything that might cause the problem. Maybe someone can spot the error?

rule "TempTrend"
when
	Time cron "0 0/5 * * * ?"
then
	//Temeraturtrend alle 5 minuten updaten
	logInfo("zuhause.rules","Checke TemeraturTrend......")
	//Draussen
	
	if (Terasse_temp.state < Terasse_temp.previousState.state as DecimalType){
		sendCommand(TempTrendTerasse,1)//ist gefallen	
	} else if (Terasse_temp.state == Terasse_temp.previousState.state as DecimalType){
		sendCommand(TempTrendTerasse,0)//ist gleich
	} else if (Terasse_temp.state > Terasse_temp.previousState.state as DecimalType){
		sendCommand(TempTrendTerasse,2)//ist gestiegen
	}
	//draussen historisch
	sendCommand(TempTrendTerasse10,TempTrendTerasse9.state.toString)
	sendCommand(TempTrendTerasse9,TempTrendTerasse8.state.toString)
	sendCommand(TempTrendTerasse8,TempTrendTerasse7.state.toString)
	sendCommand(TempTrendTerasse7,TempTrendTerasse6.state.toString)
	sendCommand(TempTrendTerasse6,TempTrendTerasse5.state.toString)
	sendCommand(TempTrendTerasse5,TempTrendTerasse4.state.toString)
	sendCommand(TempTrendTerasse4,TempTrendTerasse3.state.toString)
	sendCommand(TempTrendTerasse3,TempTrendTerasse2.state.toString)
	sendCommand(TempTrendTerasse2,TempTrendTerasse1.state.toString)
	sendCommand(TempTrendTerasse1,TempTrendTerasse.state.toString)
	//logInfo("zuhause.rules","Checke TemeraturTrend......Draussen fertig. Jetzt WoZi")
	//WoZi
	if (WoZi_Temp.state < WoZi_Temp.previousState.state as DecimalType){
		sendCommand(TempTrendWoZi,1)//gefallen
	} else if (WoZi_Temp.state == WoZi_Temp.previousState.state as DecimalType){
		sendCommand(TempTrendWoZi,0)//ist gleich
	} else if (WoZi_Temp.state > WoZi_Temp.previousState.state as DecimalType){
		sendCommand(TempTrendWoZi,2)//ist gestiegen
	}
	//histo wozi
	sendCommand(TempTrendWoZi10,TempTrendWoZi9.state.toString)
	sendCommand(TempTrendWoZi9,TempTrendWoZi8.state.toString)
	sendCommand(TempTrendWoZi8,TempTrendWoZi7.state.toString)
	sendCommand(TempTrendWoZi7,TempTrendWoZi6.state.toString)
	sendCommand(TempTrendWoZi6,TempTrendWoZi5.state.toString)
	sendCommand(TempTrendWoZi5,TempTrendWoZi4.state.toString)
	sendCommand(TempTrendWoZi4,TempTrendWoZi3.state.toString)
	sendCommand(TempTrendWoZi3,TempTrendWoZi2.state.toString)
	sendCommand(TempTrendWoZi2,TempTrendWoZi1.state.toString)
	sendCommand(TempTrendWoZi1,TempTrendWoZi.state.toString)
	logInfo("zuhause.rules","Checke TemeraturTrend......Fertig")
end

I use the rule to show a temperatur trend:

There are no errors written to the logs. Rule just starts one final time but never reaches the end:

2017-07-12 03:35:00.055 [INFO ] [smarthome.model.script.zuhause.rules] - Checke TemeraturTrend......Fertig
2017-07-12 03:40:00.006 [INFO ] [smarthome.model.script.zuhause.rules] - Checke TemeraturTrend......War: 14.699999999999999289457264239899814128875732421875 Ist: 14.7
2017-07-12 03:40:00.042 [INFO ] [smarthome.model.script.zuhause.rules] - Checke TemeraturTrend......Fertig
2017-07-12 03:45:00.009 [INFO ] [smarthome.model.script.zuhause.rules] - Checke TemeraturTrend......War: 14.699999999999999289457264239899814128875732421875 Ist: 14.7
2017-07-12 03:45:00.040 [INFO ] [smarthome.model.script.zuhause.rules] - Checke TemeraturTrend......Fertig
2017-07-12 03:50:00.007 [INFO ] [smarthome.model.script.zuhause.rules] - Checke TemeraturTrend......War: 14.699999999999999289457264239899814128875732421875 Ist: 14.7

Any ideas?
Many thanks in advance,
Best Regards,
-OLI

Which openHAB, OS and Java-versions do you use?

Hi,
Latest snapshot, Ubuntu 16.4 server, latest oracle available

There are a lot of commands being send really fast. I wonder if you are overwhelming the event bus.

The first thing I would do is use the sendCommand method on your Item rather than the sendCommand Action. The method is more efficient and might break up the logjam.

If that doesn’t work, periodically add a Thread::sleep(50) to give the system a chance to process the previously issued commands.

If that doesn’t work, file an issue and good luck! I’m out of ideas at that point.

Thanks for the suggestions.
I’ve swapped all actions to: TempTrendTerasse.sendCommand(1)
and added a sleep before and after each action block.
Fingers crossed; I’ll report back after 24 hrs…

Report: everything still running smooth even after 48ish hours.
Solution: I changed all to sendCommand method and added a Thread::sleep(50) after each method call.
Thanks for the good advice,
Regards,
-OLI

You might consider filling an issue on the esh repo on this. While you were hitting the event bus pretty hard, I don’t think it was hard enough to cause oh to crash like it did for you.

Unfortunatly things failed again - after some days. I have raised the sleep tp 100 each.
Never did file an issue. Will further gather data and raise issue when picture is complete.