Folks,
I had another thread around about my cron problems but nothing suggested in there helped.
I’ve dug deeper and have found more clues as to my problem but I am now lost… Any thoughts or help appreciated as this is now causing my “smart home” to be a “dumb home”
OH 2.4 on RPi 3B+ with nothing else running on it.
Symptoms - cron works for a few hours and then just stops working.
I’ve removed all long-running (HTTP and script task) cron rules and use a proxy item instead which cron triggers.
I’ve only got about 10 cron rules, one of which runs every minute (it’s a counter)
I’ve removed all “unnecessary” cron jobs for the sake of debugging.
To fix the problem, a restart is the only option.
The “culprit” rule
rule "Calc Last Motion ago"
when Time cron "0 0/1 * 1/1 * ? *" //every minute
then
g_MotionMinutesAgo?.allMembers.forEach[item |
if (item === null){
logWarn("Calc Last Motion ago", "Item item was null. Very odd")
return;
}
if (item.state == NULL){
item.sendCommand(0)
logWarn("Calc Last Motion ago", "Item " + item.name + " was null. Setting to zero")
}
else {
var num = (item.state as Number)
if (num === null){
logWarn("Calc Last Motion ago", item.name + " num was null. Very odd")
num = 0;
}
item.sendCommand(num + 1)
//logWarn("Calc Last Motion ago", "Setting to " + (num + 1).toString)
}
]
end
The Items:
Group:Switch g_Motion "House motion group"
Group:Number:MIN g_MotionMinutesAgo
Number MotionMinutesAgo (g_MotionMinutesAgo) ///try not use this.
Number MotionMinutesAgo_Proxy (g_MotionMinutesAgo)
Number MotionTest
Switch Hallway_MotionSensor <motion> (g_persist_change, g_Motion) { channel="mihome:sensor_motion_aq2:158d0001e5266c:motion" }
Number Hallway_MotionSensor_MotionMinutesAgo "Last Motion detected" (g_MotionMinutesAgo)
Switch Frontroom_MotionSensor <motion> (g_persist_change, g_Motion) { channel="mihome:sensor_motion_aq2:158d00029a5baf:motion" }
Number Frontroom_MotionSensor_MotionMinutesAgo "Last Motion detected" (g_MotionMinutesAgo)
//there are 4 or 5 of these items in the group.
Take a look at how out of order the log entries are. They’re all over the place.
My theory is this that when someone moves, the motion triggers the rule which resets the counter back to zero however, at the same time, the cron kicks in (or the other way around) and odd things happen. A deadlock of sorts internally trying to update the item and read them?
Whatever is happening, I get the interrupt()'ed exception and null.
This used to happen within a few hours. I changed the quartz thread count to be 5 and, while it still happens, it takes longer before cron stops working all together.
snipped log to see pattern.
1 2019-01-05 10:48:14.674 [INFO ] [home.model.script.Motion - resetting] - Motion from - Kitchen_MotionSensor - resetting to zero
2 2019-01-05 10:48:12.596 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1e2e736' takes more than 5000ms.
3 2019-01-05 10:47:37.641 [INFO ] [home.model.script.Motion - resetting] - Motion from - Hallway_MotionSensor - resetting to zero
4 2019-01-05 10:47:27.061 [WARN ] [me.model.script.Motion - Auto Lights] - Bathroom_MotionSensor caused auto-lights - state:OFF
5 2019-01-05 10:47:17.012 [WARN ] [l.script.controls.tablet.state.rules] - Brighten Screen - Setting brightness to 100.
6 2019-01-05 10:52:12.890 [WARN ] [me.model.script.Motion - Auto Lights] - Room: Bathroom
7 2019-01-05 10:49:42.950 [DEBUG] [rg.quartz.core.QuartzSchedulerThread] - batch acquisition of 1 triggers
8 2019-01-05 10:49:42.949 [ERROR] [org.quartz.simpl.SimpleThreadPool ] - Worker thread was interrupt()'ed.
9 java.lang.InterruptedException: null
10 at java.lang.Object.wait(Native Method) ~[?:?]
11 at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
12 2019-01-05 10:49:12.610 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[726]
13 2019-01-05 10:49:12.610 [DEBUG] [org.quartz.core.JobRunShell ] - Calling execute on job DEFAULT.state.motion.lastmotion.rules#Calc Last Motion ago#0 0/1 * 1/1 * ? *
14 2019-01-05 10:55:12.954 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Solar_prxy], State[144]
15 2019-01-05 10:54:42.934 [ERROR] [org.quartz.simpl.SimpleThreadPool ] - Worker thread was interrupt()'ed.
16 java.lang.InterruptedException: null
17 at java.lang.Object.wait(Native Method) ~[?:?]
18 at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
19 2019-01-05 10:53:42.928 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Event Task Processing Interrupted. Events may not be recieved in proper order.
20 2019-01-05 10:53:17.891 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1e2e736' takes more than 5000ms.
21 2019-01-05 10:53:13.007 [WARN ] [me.model.script.Motion - Auto Lights] - Turning off
22 2019-01-05 10:56:09.753 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Event Task Processing Interrupted. Events may not be recieved in proper order.
23 2019-01-05 10:55:43.145 [DEBUG] [rg.quartz.core.QuartzSchedulerThread] - batch acquisition of 1 triggers
24 2019-01-05 10:56:09.760 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[696]
25 2019-01-05 10:55:43.135 [ERROR] [org.quartz.simpl.SimpleThreadPool ] - Worker thread was interrupt()'ed.
26 java.lang.InterruptedException: null
27 at java.lang.Object.wait(Native Method) ~[?:?]
28 at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
29 2019-01-05 10:56:09.801 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Solar_prxy], State[149]
30 2019-01-05 10:56:09.843 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[701]
Full log
2019-01-05 10:46:00.005 [DEBUG] [rg.quartz.core.QuartzSchedulerThread] - batch acquisition of 0 triggers
2019-01-05 10:46:00.005 [DEBUG] [org.quartz.core.JobRunShell ] - Calling execute on job DEFAULT.state.motion.lastmotion.rules#Calc Last Motion ago#0 0/1 * 1/1 * ? *
2019-01-05 10:46:05.426 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[846]
2019-01-05 10:46:13.955 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Solar_prxy], State[147]
2019-01-05 10:46:20.420 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[770]
2019-01-05 10:46:23.940 [DEBUG] [rg.quartz.core.QuartzSchedulerThread] - batch acquisition of 0 triggers
2019-01-05 10:46:29.051 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Solar_prxy], State[149]
2019-01-05 10:46:35.417 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[733]
2019-01-05 10:46:49.459 [INFO ] [home.model.script.Motion - resetting] - Motion from - Kitchen_MotionSensor - resetting to zero
2019-01-05 10:46:47.579 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1e2e736' takes more than 5000ms.
2019-01-05 10:46:47.195 [DEBUG] [rg.quartz.core.QuartzSchedulerThread] - batch acquisition of 1 triggers
2019-01-05 10:46:44.141 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Solar_prxy], State[147]
2019-01-05 10:48:42.602 [DEBUG] [rg.quartz.core.QuartzSchedulerThread] - batch acquisition of 1 triggers
2019-01-05 10:48:42.597 [DEBUG] [org.quartz.core.JobRunShell ] - Calling execute on job DEFAULT.state.motion.lastmotion.rules#Calc Last Motion ago#0 0/1 * 1/1 * ? *
2019-01-05 10:48:29.208 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/Power_Solar_prxy] {item=Power_Solar_prxy, bridgemarker=true, command=-999, timestamp=1546685309202} | {org.osgi.service.event.EventHandler}={service.id=483, service.bundleid=192, service.scope=bundle, event.topics=openhab/command/*, ip=10.10.30.12, service.pid=org.openhab.lightwaverf, component.name=org.openhab.binding.lightwaverf.binding, component.id=202} | Bundle(org.openhab.binding.lightwaverf_1.10.0.201706251807 [192])]
java.lang.IllegalArgumentException: ENERGY_CURRENT_USAGE : is unexpected
at org.openhab.binding.lightwaverf.internal.LightwaverfConvertor.convertToLightwaveRfMessage(LightwaverfConvertor.java:93) ~[?:?]
at org.openhab.binding.lightwaverf.internal.LightwaveRfBinding.internalReceive(LightwaveRfBinding.java:264) ~[?:?]
at org.openhab.binding.lightwaverf.internal.LightwaveRfBinding.internalReceiveCommand(LightwaveRfBinding.java:246) ~[?:?]
at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:94) ~[?:?]
at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:45) ~[?:?]
at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415) [3:org.apache.karaf.services.eventadmin:4.2.1]
at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutBlacklistTiming(HandlerTask.java:82) [3:org.apache.karaf.services.eventadmin:4.2.1]
at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:104) [3:org.apache.karaf.services.eventadmin:4.2.1]
at org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks$TaskExecuter.run(AsyncDeliverTasks.java:166) [3:org.apache.karaf.services.eventadmin:4.2.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
2019-01-05 10:48:14.674 [INFO ] [home.model.script.Motion - resetting] - Motion from - Kitchen_MotionSensor - resetting to zero
2019-01-05 10:48:12.596 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1e2e736' takes more than 5000ms.
2019-01-05 10:47:37.641 [INFO ] [home.model.script.Motion - resetting] - Motion from - Hallway_MotionSensor - resetting to zero
2019-01-05 10:47:27.061 [WARN ] [me.model.script.Motion - Auto Lights] - Bathroom_MotionSensor caused auto-lights - state:OFF
2019-01-05 10:47:17.012 [WARN ] [l.script.controls.tablet.state.rules] - Brighten Screen - Setting brightness to 100.
2019-01-05 10:52:12.890 [WARN ] [me.model.script.Motion - Auto Lights] - Room: Bathroom
2019-01-05 10:50:12.855 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/Power_Main] {item=Power_Main, bridgemarker=true, command=-999, timestamp=1546685316203} | {org.osgi.service.event.EventHandler}={service.id=483, service.bundleid=192, service.scope=bundle, event.topics=openhab/command/*, ip=10.10.30.12, service.pid=org.openhab.lightwaverf, component.name=org.openhab.binding.lightwaverf.binding, component.id=202} | Bundle(org.openhab.binding.lightwaverf_1.10.0.201706251807 [192])]
java.lang.IllegalArgumentException: ENERGY_CURRENT_USAGE : is unexpected
at org.openhab.binding.lightwaverf.internal.LightwaverfConvertor.convertToLightwaveRfMessage(LightwaverfConvertor.java:93) ~[?:?]
at org.openhab.binding.lightwaverf.internal.LightwaveRfBinding.internalReceive(LightwaveRfBinding.java:264) ~[?:?]
at org.openhab.binding.lightwaverf.internal.LightwaveRfBinding.internalReceiveCommand(LightwaveRfBinding.java:246) ~[?:?]
at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:94) ~[?:?]
at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:45) ~[?:?]
at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415) [3:org.apache.karaf.services.eventadmin:4.2.1]
at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutBlacklistTiming(HandlerTask.java:82) [3:org.apache.karaf.services.eventadmin:4.2.1]
at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:104) [3:org.apache.karaf.services.eventadmin:4.2.1]
at org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks$TaskExecuter.run(AsyncDeliverTasks.java:166) [3:org.apache.karaf.services.eventadmin:4.2.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
2019-01-05 10:49:42.950 [DEBUG] [rg.quartz.core.QuartzSchedulerThread] - batch acquisition of 1 triggers
2019-01-05 10:49:42.949 [ERROR] [org.quartz.simpl.SimpleThreadPool ] - Worker thread was interrupt()'ed.
java.lang.InterruptedException: null
at java.lang.Object.wait(Native Method) ~[?:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
2019-01-05 10:49:12.610 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[726]
2019-01-05 10:49:12.610 [DEBUG] [org.quartz.core.JobRunShell ] - Calling execute on job DEFAULT.state.motion.lastmotion.rules#Calc Last Motion ago#0 0/1 * 1/1 * ? *
2019-01-05 10:55:12.954 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Solar_prxy], State[144]
2019-01-05 10:54:42.934 [ERROR] [org.quartz.simpl.SimpleThreadPool ] - Worker thread was interrupt()'ed.
java.lang.InterruptedException: null
at java.lang.Object.wait(Native Method) ~[?:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
2019-01-05 10:53:42.928 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Event Task Processing Interrupted. Events may not be recieved in proper order.
2019-01-05 10:53:17.891 [WARN ] [me.core.internal.events.EventHandler] - Dispatching event to subscriber 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1e2e736' takes more than 5000ms.
2019-01-05 10:53:13.007 [WARN ] [me.model.script.Motion - Auto Lights] - Turning off
2019-01-05 10:56:09.753 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Event Task Processing Interrupted. Events may not be recieved in proper order.
2019-01-05 10:55:43.145 [DEBUG] [rg.quartz.core.QuartzSchedulerThread] - batch acquisition of 1 triggers
2019-01-05 10:56:09.760 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[696]
2019-01-05 10:55:43.135 [ERROR] [org.quartz.simpl.SimpleThreadPool ] - Worker thread was interrupt()'ed.
java.lang.InterruptedException: null
at java.lang.Object.wait(Native Method) ~[?:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
2019-01-05 10:56:09.801 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Solar_prxy], State[149]
2019-01-05 10:56:09.843 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Main], State[701]
2019-01-05 10:56:09.861 [INFO ] [htwaverf.internal.LightwaveRfBinding] - Update from LightwaveRf ItemName[Power_Solar_prxy], State[144]