ultimate cron cron jobs are running fine but status report page shows, some jobs are behind schedule

Created on 11 March 2018, over 7 years ago
Updated 27 February 2025, 6 months ago

ultimate cron cron jobs are running fine but status report page shows, some jobs are behind schedule.

I have 9 cron jobs, 1 job has to run every week , 6 everyday once at 12 am and 1 is at 15mins and other one is at every 5 minutes. I have set main cron to run at every 5 minutes.

Cron are running fine whatever the interval we set, but in status report page I can see some warning like cron jobs are running behind the schedule.

I have try to debug the jobs modules/contrib/ultimate_cron/src/Plugin/ultimate_cron/Scheduler/Crontab.php file isBehind(CronJob $job) method.

isBehind methos is trying to figure out the behind value. Suppose if my cron runs at every 5 minutes and it got triggered at 11.30 next cron job running time is 11.35, cron job is running at 11.35. But isBehind showing next cron job running time is 11.32. My cron job ran at 11.30 and if I access status report page between 11.30 to 11.35, I can see 1 job behind the schedule error. If we try to access status report page at 11.34 then job which ran already at 11.30 but next cron job running time suppose to be 11.35 but isBehind methods fetch as 11.32. 2 minutes diference is calcuated as behind value and we are getting warning.

Similar to all jobs. Even though when all cron jobs ran at specified interval.

Please help me resolving the warning.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India flutterstack

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium lisotton Brussels

    I have a similar case. I have many jobs configured and the most frequent ones are configured to run every 15 minutes. I have the system cron calling the drush command every 5 minutes, but still in the Status Report page I have, from time to time, jobs being reported as behind schedule. In the list of jobs, as you can see in the attached screenshot, the first job in the list had ran at 10:25 and now is 10:36 and it is already reported as behind schedule:

    I think a job should be reported as behind schedule only if the last run is more than 15 minutes ago, if the job is configured to run every 15 minutes. In this case, it has passed 11 minutes and the job is already reported as behind schedule.

  • Pipeline finished with Success
    6 months ago
    Total: 149s
    #442674
  • 🇧🇪Belgium lisotton Brussels

    I have worked in a MR that do not report Simple jobs as behind if the last run was within the configured interval. For example, if a job is configured to run every 15 minutes, it will be reported as behind only if it is more than 15 minutes since the last run.

    This will clear the warning in the Status Report page.

  • Status changed to Needs work about 1 hour ago
  • 🇨🇭Switzerland berdir Switzerland

    This is a good start, but I it's only implemented for the Simple plugin and only holds up for short intervals.

    If you have something set to run every 3 hours and it hasn't run in 5 hours then I think it's running behind.

    What if we instead just add a fixed, configurable offset? Can be added to the global settings page and default to 15min or so. requirements_behind_offset or so, with label "Warn about cron jobs running behind more than the given offset" or so. Maybe a -1 to disable it.

    That could be implemented directly in the requirements hook, because there are some other calls to isBehind() that should still report it as such.

Production build 0.71.5 2024