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

Complete cron script normally if unable to get core_cron lock

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.8.8, 2.9.2
    • Fix Version/s: None
    • Component/s: General, Other, Unknown
    • Labels:
      None
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                maherne Michael Aherne
                Reporter:
                maherne Michael Aherne
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: