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

Memory shortage on statistics page

XMLWordPrintable

    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MDL-58096-master
    • Hide

      To get this error, your database needs to be big enough : for us it worked with 41530 rows in the course table, and the problem occurred with 56530 rows (fixed by removing the fullname field) and still a problem even with the removal of the fullname field with 62804 rows.

      For testing, you need a database with some history and many courses. I reproduced it with 2 scenarios (see my comments below for more details ) :

      • Scenario 1 : 23486 courses (use ini_set('memory_limit', '36M') to reproduce it without the fix)
      • Scenario 2 : 62804 courses (use ini_set('memory_limit', '128M' or leave it like this if its your default) to reproduce it without the fix)

      It can be reproduced with less courses if you fix the memory limit accordingly in the report_stats_report() function in the /app/apache2/htdocs/moodle/report/stats/locallib.php file.

      After you adapt the memory limit based on the courses you have in your database, follow these steps:

      Navigate to Home / ► Front page settings / ► Reports / ► Statistics
      Without the patch, you get a blank page and the ""Allowed memory size..." message in your PHP error log.
      With the patch, you will no longer have the problem.

      Here is some code useful to get the memory metrics:

      // Get the current memory limit:
      echo display_size(get_real_size(ini_get('memory_limit'))) . "<br>";
       
      // Set the meory limit:
      ini_set('memory_limit', '256M');
       
      // Get the current memory usage:
      echo display_size(memory_get_usage(true)) . "<br>";

       

      Show
      To get this error, your database needs to be big enough : for us it worked with 41530 rows in the course table, and the problem occurred with 56530 rows (fixed by removing the fullname field) and still a problem even with the removal of the fullname field with 62804 rows. For testing, you need a database with some history and many courses. I reproduced it with 2 scenarios (see my comments below for more details ) : Scenario 1 : 23486 courses (use ini_set('memory_limit', '36M') to reproduce it without the fix) Scenario 2 : 62804 courses (use ini_set('memory_limit', '128M' or leave it like this if its your default) to reproduce it without the fix) It can be reproduced with less courses if you fix the memory limit accordingly in the report_stats_report() function in the /app/apache2/htdocs/moodle/report/stats/locallib.php file. After you adapt the memory limit based on the courses you have in your database, follow these steps: Navigate to Home / ► Front page settings / ► Reports / ► Statistics Without the patch, you get a blank page and the ""Allowed memory size..." message in your PHP error log. With the patch, you will no longer have the problem. Here is some code useful to get the memory metrics: // Get the current memory limit: echo display_size(get_real_size(ini_get( 'memory_limit' ))) . "<br>" ;   // Set the meory limit: ini_set( 'memory_limit' , '256M' );   // Get the current memory usage: echo display_size(memory_get_usage( true )) . "<br>" ;  

      When going on /report/stats/index.php, we get an "Allowed memory size of 134217728 bytes exhausted (tried to allocate 60 bytes) in /app/apache2/htdocs/moodle/lib/dml/mysqli_native_moodle_database.php on line 1107" error.
      The database has to be pretty big for this to occur.

            leblangi Gilles-Philippe Leblanc
            ligned David Ligne
            Ankit Agarwal Ankit Agarwal
            David Monllaó David Monllaó
            cameron1729 cameron1729
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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