Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-51744

Complete cron script normally if unable to get core_cron lock

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.8.8, 2.9.2
    • General, Other
    • None
    • MOODLE_28_STABLE, MOODLE_29_STABLE

      At the moment, if the cron script is unable to get the next scheduled task because another instance of the script has the core_cron lock, it terminates with a message something like this:

      !!! The operation timed out while waiting for a lock. !!!
      !!
      Error code: locktimeout !!
      !! Stack trace: * line 446 of /lib/classes/task/manager.php: moodle_exception thrown
      * line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
      * line 61 of /admin/cli/cron.php: call to cron_run()
       !!
      

      This looks a lot like there has been a problem, but it seems actually to be expected behaviour. (That is to say, where multiple cron processes are running, it's standard operation for one of them to be able to grab the core_cron lock and prevent the other processes from running any tasks.)

      It would be much better if, rather than terminating immediately on the exception being thrown, the script were to terminate as normal - printing "Cron script completed correctly" etc, and doing garbage collection.

            maherne Michael Aherne
            maherne Michael Aherne
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.