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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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

      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?

        Gliffy Diagrams

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

          Issue Links

            Activity

            quen Sam Marshall created issue -
            quen Sam Marshall made changes -
            Field Original Value New Value
            Attachment memoryissues2.patch [ 16757 ]
            quen Sam Marshall made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            skodak Petr Skoda made changes -
            Link This issue has been marked as being related by MDL-19288 [ MDL-19288 ]
            mlzjens Jens Eremie made changes -
            Link This issue has a non-specific relationship to MDL-19702 [ MDL-19702 ]
            dougiamas Martin Dougiamas made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            dougiamas Martin Dougiamas made changes -
            Workflow jira [ 31358 ] MDL Workflow [ 62242 ]
            dougiamas Martin Dougiamas made changes -
            Workflow MDL Workflow [ 62242 ] MDL Full Workflow [ 91446 ]

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/May/09