Moodle
  1. Moodle
  2. MDL-18768

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.4
    • Fix Version/s: 1.9.5
    • Component/s: Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      31787

      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?

      1. memoryissues.patch
        6 kB
        Sam Marshall
      2. memoryissues2.patch
        6 kB
        Sam Marshall

        Issue Links

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: