Cron Scheduler: Job seems to be executed to early #4145
Comments
@maggu2810 I do agree that delaying the execution with an arbitrary amount of time is not ok. I was not able to reproduce the problem. Here is the test setup:
I chose 20:04:00 instead of midnight because that about 1 minute in the future right now, but I the outcomes should be the same. This is the output I get 2017-09-07 20:03:26.569 [TRACE] [r$ExpressionThreadPoolExecutor:187 ] - Expression's '0 4 20 * * ? *' next execution time is 2017-09-07T20:04:00.000+0200 As you can see the monitor task woke up 1 ms after it is supposed to happen, and the scheduled task is finally executed 22 ms after the calculated cron expression. Those 22 ms seconds are partly spent by the CronExpression recalculating its next execution, and the ExpressionThreadPoolExecutor executing other code. I am puzzled as how it could be that tasks execute before their scheduled execution. I can only explain that by something happening java.util.concurrent. wdyt? |
@kgoderis I didn't analyze the cause myself. @triller-telekom reported that problem and explained me that this problem exists. Perhaps he can give more details what he analyzed. |
It didn't happen to me so I cannot reproduce it, also with an old version, but I saw the problem in the logoutput from @kaimahnke here. The scheduling happens slightly before midnight... |
@maggu2810 cfr #4018 (comment), shall we close this issue then? |
@kgoderis I don't think so. The root cause has not been found or fixed. |
@maggu2810 You're right. Anyways, I am unable to reproduce this (outside of the Astro binding) |
@here Please send me a sample Scheduler in eclipse smarthome java file with below exression. Regards, |
It seems that a cron expression that for daily midnight ("0 0 0 * * ? *") could lead to an job execution on the "day before".
See comments here: #4131
IMHO the common behavior of a scheduled job is to be executed on the expected time or a little bit later, but not sooner.
That a cron job that should be executed on midnight has to add a delay just to be sure to be executed on the correct day seems to be wrong to me.
The text was updated successfully, but these errors were encountered: