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

Moodle has memory issues with large sites e.g. in role_assign

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.9.4
    • 1.9.5
    • Libraries
    • None
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE

    Description

      If you role_assign somebody to the teacher role at site level on a large site (~5k courses, ~110k contexts), this runs out of memory.

      There are three causes:

      1) In forum_role_assign, it does get_records('course'). This should restrict to required fields (only id!) and should be a recordset anyway. Easily changed.

      but more seriously

      2) The get_fast_modinfo data is cached. This cache gradually expands to contain the complete modinfo for all courses.

      and

      3) get_fast_modinfo also causes contexts to be cached. This cache gradually expands to contain all contexts for courses, modules, and blocks (ie virtually the whole context table).

      Petr suggested that the best approach would be to limit the size of these caches, discarding old records. I have implemented this. The changes appear to work (the memory issues go away) on our test system.

      Could somebody review this patch please as it's for 1.9 and is not trivial?

      Attachments

        Issue Links

          Activity

            People

              quen Sam Marshall
              quen Sam Marshall
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                13/May/09