Hi all,
my rules triggered by cron (acutally also rules triggered by astro phase change channels) are executed too late.
Unfortunately I was not observant enought to see when this started happening - could have been with my update to 2.5.7.
My current setup is OH 2.5.9 running in a docker container on a Linux machine, all rules are using NRE Jython.
I set up the following (NRE Jython) rules, in order to pin down the problem:
@rule("debug")
@when("Time cron 0 /5 * * * ? *")
def cron_test(event):
my_log = Logger(cron_test, event)
my_log.message("cron every 5th minute started")
@rule("debug 2")
@when("Time cron 0 0 /2 * * ? *")
def cron_test_2(event):
my_log = Logger(cron_test_2, event)
my_log.message("cron every 2nd hour started")
@rule("debug 3")
@when("Time cron 0 0 8 * * ? *")
def cron_test_3(event):
my_log = Logger(cron_test_3, event)
my_log.message("cron on 8 AM started")
The Logger class used above is a wrapper for logging, I can see in other places where it is used, that it creates immediate log entries - so no delay coming from this.
When I tail the log, I can see that the timestamp for log entries is matching the current time, so system clock and openhab time seem to be fine (what I want to say is: log time = time on linux server = time on my desktop machine = actual time here in my TZ).
All the entries I see in my log are later than what the cron dictates.
The every 5 minutes have a ca. 20s lag (just showing some examples from the log):
2020-10-04 12:05:21.950 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:10:22.825 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:15:19.876 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:20:21.862 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:25:22.467 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:30:19.280 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:35:20.990 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:40:23.794 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:45:19.087 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:50:21.763 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 12:55:23.251 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
2020-10-04 13:00:18.304 [INFO ] [jsr223.jython.debug ] - cron_test message // cron every 5th minute started
The every 2h are up to 8 minutes late ?!
2020-10-03 20:05:55.916 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
2020-10-03 22:08:24.183 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
2020-10-04 00:08:10.729 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
2020-10-04 02:08:13.206 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
2020-10-04 04:08:11.867 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
2020-10-04 06:08:14.209 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
2020-10-04 08:08:11.166 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
2020-10-04 10:08:14.407 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
2020-10-04 12:08:16.437 [INFO ] [jsr223.jython.debug 2 ] - cron_test_2 message // cron every 2nd hour started
And the 8 am one is a whopping 58 minutes late:
2020-10-04 08:58:46.922 [INFO ] [jsr223.jython.debug 3 ] - cron_test_3 message // cron on 8 AM started
I’d be really happy to get some pointers no what could be going wrong here.
If more log-data is needed, I’ll provide it.
Cheers & have a great Sunday!
Bastian