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

plugin modifies default timeout in locallib and backup is affected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • 2.6.3, 2.7.3, 2.8.1
    • Backup
    • MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Team '; drop tables Sprint 7

      This is how I understand the problem. Correct me if I'm wrong.

      When Moodle does a backup it runs through the file core_backup_progress.class.php In that file it sets up the progress meter. It then gives a constant called TIME_LIMIT_WITHOUT_PROGRESS. hard coded to 120

      it then uses that constant in the progress() function
      set_time_limit(self::TIME_LIMIT_WITHOUT_PROGRESS);

      So if the progress bar doesn't get updated in 2 minutes, it times out and ends the script.

      when creating a zip file, backup first makes the layout for the .zip in the temp directory under a long ugly folder name. This folder is used as the zip structure. During backup everything goes fine until it is time to finish the .zip file with the close() function. This function works very slowly, so if there are too many files or too big of files to process in 2 minutes it will run into the hard coded 120 second limit and time out with an error like:

      PHP Fatal error: Maximum execution time of 120 seconds exceeded in \\lib\\filestorage
      zip_archive.php on line 218

      the part that times when zip_archive.php runs it's close() function. Inside this function, no progress updates are being sent out. I placed a set_time_limit(0); before the close function, and now everything works great.

      set_time_limit(0);
      $res = $this->za->close();

      Let me know if there is anything I'm not grasping. Thanks!

            Votes:
            32 Vote for this issue
            Watchers:
            29 Start watching this issue

              Created:
              Updated:
              Resolved:

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