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

Course import runs out of memory when user has update capability on large number of courses

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.8
    • Fix Version/s: 1.9.9, 2.0
    • Component/s: Course
    • Labels:
      None
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      Import activities tool runs out of memory when trying to load a large number of courses user has taught in, encountered within environment running 2500 courses logged in as administrator with memory_limit of 96M.

      Upon selecting import within any course the following error is displayed: "PHP Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 86 bytes) in /moodle/lib/dmllib.php on line 728, referer: http://<moodlesite>/course/view.php?id=1225".

      The file course/import/activities/mod.php loads all courses where user has permission 'moodle/course:update' but does not restrict fields causing the result set to become quite large in certain scenarios.

      This bug may be difficult to replicate due to number of courses in my environment but you will need to create a large number of courses, be logged in with moodle/course:update permissions on all courses and select import course on any course.

      I've attached a patch to restrict fields to id and fullname, which are the only fields required to import activities.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    8/Jun/10