Moodle

Multiple cron instance running parallely

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7
  • Fix Version/s: STABLE backlog
  • Component/s: Unknown
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE

Description

A new cron instance should not run if previous cron is still running.

Issue Links

Activity

Hide
Henning Bostelmann added a comment -

This can probably best be achieved on the operating system level!

If the cron script is started on Linux via the CLI, then lckdo can prevent duplicate execution. (http://linux.die.net/man/1/lckdo)

Show
Henning Bostelmann added a comment - This can probably best be achieved on the operating system level! If the cron script is started on Linux via the CLI, then lckdo can prevent duplicate execution. (http://linux.die.net/man/1/lckdo)
Hide
jai gupta added a comment -

I don't know which method will be best.

Drupal does same thing by setting a flag when cron starts and resetting it at cron end.

Another cron checks that flag and refuses to run if it is already set.

This problem has an disadvantage that if cron breaks in mid it won't reset cron flag. A workaround could be setting a timestamp with cron flag and calculate last cron run time.

Show
jai gupta added a comment - I don't know which method will be best. Drupal does same thing by setting a flag when cron starts and resetting it at cron end. Another cron checks that flag and refuses to run if it is already set. This problem has an disadvantage that if cron breaks in mid it won't reset cron flag. A workaround could be setting a timestamp with cron flag and calculate last cron run time.
Hide
Rosario Carcò added a comment -

If you check on the operating system level, a hang during the backups which for our more than 4'700 courses and 225 GB of data take 27 hours, would mean that cron could not do all of the other tasks, like sending forum posts and digest eMails to the users. Or how is cron.php supposed to do backups and all the other tasks? Does the cron.php code wait until every zipping of every backup-zip-file is done one by one? which means that it will hang, if a course is corrupt or can not be zipped/backed up for some unexpected reason. Actually I have more than 700 courses out of 4'700 which are reported to have been skipped. It takes a very long time to verify each single course at this magnitude to see why it can't be backed up correctly.

Show
Rosario Carcò added a comment - If you check on the operating system level, a hang during the backups which for our more than 4'700 courses and 225 GB of data take 27 hours, would mean that cron could not do all of the other tasks, like sending forum posts and digest eMails to the users. Or how is cron.php supposed to do backups and all the other tasks? Does the cron.php code wait until every zipping of every backup-zip-file is done one by one? which means that it will hang, if a course is corrupt or can not be zipped/backed up for some unexpected reason. Actually I have more than 700 courses out of 4'700 which are reported to have been skipped. It takes a very long time to verify each single course at this magnitude to see why it can't be backed up correctly.

People

Vote (6)
Watch (9)

Dates

  • Created:
    Updated: