The more I add components to my OpenHAB, logic and rules, the more strange things happen inside.
I had some problem with rules and delays inside them that are now resolved. But now I have issues with NOT CREATING TIMER(?).
I had a rule (I noticed issue on this one for now) that normally works, but sometimes it fails to complete. It start running, and when inside it timer is created, it doesn’t.
Rule fragment:
rule "Gate opening"
when
Item Stan_bramy_wjazdowej changed to OFF //Opening
then
logInfo("KWI.debug.rules","REGRUN: Gate move - Opened")
if(tRBW === null) {
logInfo("KWI.debug.rules","R_DEBUG: tRBW 1")
nRBW = 0
logInfo("KWI.debug.rules","R_DEBUG: tRBW 2")
tRBW = createTimer(now, [|
logInfo("KWI.debug.rules","R_DEBUG: tRBW 3 (" + tRBW + ")")
nRBW = nRBW + 1
logInfo("KWI.debug.rules","R_DEBUG: tRBW 4 (" + tRBW + ")")
and log from one of run iterations:
2019-04-05 15:30:18.226 [INFO ] [arthome.model.script.KWI.debug.rules] - REGRUN: Gate move - Opened
2019-04-05 15:30:18.227 [INFO ] [arthome.model.script.KWI.debug.rules] - R_DEBUG: tRBW 1
2019-04-05 15:30:18.229 [INFO ] [arthome.model.script.KWI.debug.rules] - R_DEBUG: tRBW 2
2019-04-05 15:30:18.231 [INFO ] [arthome.model.script.KWI.debug.rules] - R_DEBUG: tRBW 3 (null)
2019-04-05 15:30:18.231 [INFO ] [arthome.model.script.KWI.debug.rules] - R_DEBUG: tRBW 4 (null)
2019-04-05 15:30:18.232 [INFO ] [arthome.model.script.KWI.debug.rules] - R_DEBUG: tRBW 5 (null)
2019-04-05 15:30:18.241 [INFO ] [arthome.model.script.KWI.debug.rules] - R_DEBUG: tRBW 6 (null)
As you can see, in step “R_DEBUG: tRBW 3 (null)” timer should be created already, but it’s still null (to the end of rule run.
Could it be related with free threads? Are timeras dependent from threads?
My thread settings:
openhab> config:list “(service.pid=org.eclipse.smarthome.threadpool)”
shell:threads --list |grep “uleEngine” | wc -l
shell:threads --list |grep “discovery” | wc -l
shell:threads --list |grep “safeCall” | wc -l
shell:threads --list |grep “thingHandler” | wc -l
Pid: org.eclipse.smarthome.threadpool
BundleLocation: null
Properties:
RuleEngine = 15
discovery = 5
safeCall = 10
service.pid = org.eclipse.smarthome.threadpool
thingHandler = 5
6 6
7 7
10 10
6 6