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

plugin modifies default timeout in locallib and backup is affected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.6.3, 2.7.3, 2.8.1
    • Fix Version/s: None
    • Component/s: Backup
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Sprint:
      Team '; drop tables Sprint 7

      Description

      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!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              emerrill Eric Merrill
              Reporter:
              syxton Matthew Davidson
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              32 Vote for this issue
              Watchers:
              32 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: