Cron sometimes doesn't fire
Posted: 01 Mar 2019 19:58
Sometimes, in rare cases, cron doesn't fire. That's most annoying if heating remains cold or if irrigation is running whole night. It happened to me several times in last months.
One possible reason I found now:
From time to time execution of the timer is delayed for more than one minute. When a cron task has to be executed in this minute, it is skipped.
I proved this by adding some code to cron's index.js (see attached file), which checks this and writes a console message. And indeed I found this message in log file:
Solution may be: instead current minute take last minute + 1. I added this to the attached index.js.
I don't know the reason for these delays. My Raspi3 is only lightly loaded. But it happens. A Raspberry Pi is not a real-time process computer.
One possible reason I found now:
From time to time execution of the timer is delayed for more than one minute. When a cron task has to be executed in this minute, it is skipped.
I proved this by adding some code to cron's index.js (see attached file), which checks this and writes a console message. And indeed I found this message in log file:
Code: Select all
[2019-02-28 20:23:15.092] [I] [core] Cron: tDelta=2 minutes, time reset to last minute +1
I don't know the reason for these delays. My Raspi3 is only lightly loaded. But it happens. A Raspberry Pi is not a real-time process computer.