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

Allowed memory size exhausted error when importing a resource with empty file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 2.6.3
    • Backup
    • None
    • MOODLE_26_STABLE

      We found this error in a specific circumstance.

      First, we have a huge database and we discovered that we have 976497 instances of a specific file in mdl_files: an empty file (0ko).

      Its impossible to drop this file directly in the file picker but its allowed when the file is in a zip file first before being unzipped.

      To reproduce:

      1. First, you need to do this on a huge database with many empty files. To check if you have many of this file with this query:

        SELECT COUNT(*) FROM mdl_files WHERE contenthash = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
        

      2. On your computer, create an empty file and compress it into a zip file
      3. Create two empty courses
      4. In the first course create a file resource types
      5. In this resource, import the zip file
      6. Unzip the file and delete it to keep only the unzipped empty file.
      7. In the second course, import the course containing the resource activity with the empty file.
      8. The error will occur.

      A possible solution could be to prevent the deposit of an empty file in a zip file as it is already forbidden outside a zip.
      Another would be to see if the import process really needs to loop through all instances of a file that is really expensive in memory.

            Unassigned Unassigned
            leblangi Gilles-Philippe Leblanc
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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