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

Global Search runs out of memory if a user has access to a lot of courses.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.5.1, 3.8.4, 3.9.1
    • Fix Version/s: None
    • Component/s: Global search, Performance
    • Labels:
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE

      Description

      We're experiencing an issue with Global Search when a user has access to a large number of courses and resources. It seems to be a similar issue to MDL-60826 but for search rather than calendar.

      Much like that calendar bug, it looks like the search engine builds a list of contexts the user can access and filters the Solr results so users only see things they have access to. This section of code appears to be failing on users with access to a large amount of material.

      If a user tries to use the search box, and they have been given Manager access either at site level or to a category with lots of subcategories and courses, the page will stall for several minutes until it reaches the PHP memory limit, at which point it dies.

      Site administrators aren't affected, because the context gathering code is skipped and the function just returns 'everything'.

      Ordinary teachers and students aren't affected, because they don't have access to a ridiculous number of contexts.

      I'm away from my work computer right now, but I've had a quick look and get_areas_user_accesses() in /search/clases/manager.php is my prime suspect.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            lexx_koto Alex Walker
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            5 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated: