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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.9.9, 2.0
    • 1.9.8
    • Course
    • None
    • PostgreSQL
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE, MOODLE_20_STABLE

      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.

            dougiamas Martin Dougiamas
            luketucker Luke Tucker
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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