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

"Site administration ► Reports ► Logs" gives "Fatal error: Allowed memory size of 134217728 bytes exhausted"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.5, 2.1.2, 2.2
    • Fix Version/s: 2.0.6, 2.1.3
    • Component/s: Course
    • Labels:
      None
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Going to site "Site administration ► Reports ► Logs" gives header and title "Choose which logs you want to see:" and below is empty.

      If error reporting in switched on, then PHP error occurs: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /home/moodle/public_html/lib/dml/mysqli_native_moodle_database.php on line 820

      Expected result is the logs page.

      Show
      Going to site "Site administration ► Reports ► Logs" gives header and title "Choose which logs you want to see:" and below is empty. If error reporting in switched on, then PHP error occurs: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /home/moodle/public_html/lib/dml/mysqli_native_moodle_database.php on line 820 Expected result is the logs page.
    • Workaround:
      Hide

      Adding limit to course/report/log/lib.php(353):

          $courseusers = get_enrolled_users($context, '', $selectedgroup, 'u.id, u.firstname, u.lastname, u.idnumber', 'lastname ASC, firstname ASC', 0, 10000);

      shows the page, but not all users.

      Is there a way to get the users list with less memory?

      Show
      Adding limit to course/report/log/lib.php(353): $courseusers = get_enrolled_users($context, '', $selectedgroup, 'u.id, u.firstname, u.lastname, u.idnumber', 'lastname ASC, firstname ASC', 0, 10000); shows the page, but not all users. Is there a way to get the users list with less memory?
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:

      Description

      Going to site "Site administration ► Reports ► Logs" runs out of memory on our Moodle installation.

      Our site:

      • PHP memory limit: 128M
      • ~ 75 000 rows in users table.

      Little debugging shows, that the problem is in:

      #0 /home/moodle/public_html/lib/accesslib.php(3259): mysqli_native_moodle_database->get_records_sql('SELECT u.id, u....', Array, 0, 0)
      #1 /home/moodle/public_html/course/report/log/lib.php(353): get_enrolled_users(Object(stdClass), '', 0, 'u.id, u.firstna...', 'lastname ASC, f...')
      #2 /home/moodle/public_html/course/report/log/index.php(157): print_log_selector_form(Object(stdClass), 0, '1318712400', '', '', '', 0, 0, 1, 'showashtml')
      #3 {main}

        Gliffy Diagrams

          Issue Links

            Activity

            mangus Mart Mangus created issue -
            poltawski Dan Poltawski made changes -
            Field Original Value New Value
            Link This issue has a non-specific relationship to MDL-17837 [ MDL-17837 ]
            poltawski Dan Poltawski made changes -
            Assignee moodle.com [ moodle.com ] Dan Poltawski [ poltawski ]
            poltawski Dan Poltawski made changes -
            Status Open [ 1 ] Waiting for integration review [ 10010 ]
            Pull from Repository git://git.luns.net.uk/moodle
            Fix Version/s 2.1.3 [ 11251 ]
            Pull 2.1 Branch MDL-29803
            Pull 2.1 Diff URL https://git.luns.net.uk/?p=moodle.git;a=commit;h=541a9978a8d3c4fe09d9b2d342e28fcacc97a410
            Hide
            poltawski Dan Poltawski added a comment -

            I have used the approach from MDL-17837 to at least fix this problem with the logs not displaying at all.

            However, it will still break on pressing the more button (attempting to display more users) - really there needs to be a better interface to fix that.

            Integrators: can be cherry-picked to master and 20_STABLE

            Show
            poltawski Dan Poltawski added a comment - I have used the approach from MDL-17837 to at least fix this problem with the logs not displaying at all. However, it will still break on pressing the more button (attempting to display more users) - really there needs to be a better interface to fix that. Integrators: can be cherry-picked to master and 20_STABLE
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

            TIA and ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
            stronk7 Eloy Lafuente (stronk7) made changes -
            Currently in integration Yes [ 10041 ]
            stronk7 Eloy Lafuente (stronk7) made changes -
            Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
            Integrator stronk7
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Integrated to 20, 21 and master, thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Integrated to 20, 21 and master, thanks!
            stronk7 Eloy Lafuente (stronk7) made changes -
            Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
            Affects Version/s 2.0.5 [ 10950 ]
            Affects Version/s 2.2 [ 10656 ]
            Fix Version/s 2.0.6 [ 11250 ]
            rwijaya Rossiani Wijaya made changes -
            Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
            Tester rwijaya
            Hide
            rwijaya Rossiani Wijaya added a comment -

            I don't have large user in my testing site. Therefore this issue is working fine on my system.

            I will try to find a large sample site and test it there.

            If anybody else has a large site and want to test it on their system, I would appreciated.

            Thanks

            Show
            rwijaya Rossiani Wijaya added a comment - I don't have large user in my testing site. Therefore this issue is working fine on my system. I will try to find a large sample site and test it there. If anybody else has a large site and want to test it on their system, I would appreciated. Thanks
            Hide
            poltawski Dan Poltawski added a comment -

            Just to note that you can test this by creating a large user dataset with a csv file and then try uploading it - this is how I did it

            Show
            poltawski Dan Poltawski added a comment - Just to note that you can test this by creating a large user dataset with a csv file and then try uploading it - this is how I did it
            Hide
            mangus Mart Mangus added a comment -

            Hei!

            The fix works as described – logs page now appear but pressing "more" button brings out of memory error.

            Tested with the same site that is in description of this bug.

            Thanks!

            Show
            mangus Mart Mangus added a comment - Hei! The fix works as described – logs page now appear but pressing "more" button brings out of memory error. Tested with the same site that is in description of this bug. Thanks!
            Hide
            rwijaya Rossiani Wijaya added a comment -

            Hi Mart,

            Thank you for testing this issue.

            I also tested this issue with 75000 users and confirm that the more button produce out of memory error. I will create a new issue to fix the more button page.

            The patch works on addressing this issue, therefore I'm passing this test.

            Show
            rwijaya Rossiani Wijaya added a comment - Hi Mart, Thank you for testing this issue. I also tested this issue with 75000 users and confirm that the more button produce out of memory error. I will create a new issue to fix the more button page. The patch works on addressing this issue, therefore I'm passing this test.
            rwijaya Rossiani Wijaya made changes -
            Status Testing in progress [ 10011 ] Tested [ 10006 ]
            rwijaya Rossiani Wijaya made changes -
            Link This issue has a non-specific relationship to MDL-30212 [ MDL-30212 ]
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Yes, you got this finally upstream, just in time for Moodle 2.2beta. Congrats and thanks!

            Ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Yes, you got this finally upstream, just in time for Moodle 2.2beta. Congrats and thanks! Ciao
            stronk7 Eloy Lafuente (stronk7) made changes -
            Status Tested [ 10006 ] Closed [ 6 ]
            Resolution Fixed [ 1 ]
            Currently in integration Yes [ 10041 ]
            Integration date 15/Nov/11
            Subversion JIRA

            Links Hierarchy

             Documentation

            Invalid license: EXPIRED

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  28/Nov/11