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

Memory exhaustion error when trying to add/edit calendar event as admin

XMLWordPrintable

    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MDL-60826-master
    • Hide
      Setup
      1. Create a fresh install.
      2. Login as admin
      3. Create 3 courses c1, c2 and c3 setting the start date to few days in the past (at least 2 days)
      4. Enrol a teacher t1 and a student s1 in c1 and c2
      Default group visibility testing.
      1. Open the site in incognito mode and login as t1
      2. Go to Calendar and click New event button.
      3. Make sure you see *User and Course in the Type of event drop down*.
      4. You should NOT see Group in the event type drop down
      5. Fill the form and select event type course and select c1 in the course field and save.
      6. Make sure the event was created
      7. Click on the event title and make sure the information displayed is correct in the event summary.
      Group event type functionality testing on site context
      1. In the admin tab, create 4 groups g1 and g2 in c1 and g3 and g4 in c2.
      2. In the teacher tab, reload the month view and click New event button again.
        • Make sure the event type drop down now has also Group option.
        • Please note: there’s a existing bug on the group field, where it doesn't display the field as disabled. For more info see MDL-XXXX
      3. Fill the form and select Group event type and select c1 in the course field.
      4. Make sure the group field displays g1 and g2
        • IMPORTANT: If the group field looks disable or doesn't show groups, please purge your caches.
      5. Change to c2 in the course field.
      6. Make sure group field options now changed to g3 and g4
      7. Choose g4 in the group field and save.
      8. Please note, the group event is not visible yet, on the month view change Detailed month view for field to c2
      9. Make sure the event was created.
      10. Click on the event.
      11. Make sure the event type displayed is Group and the group is g4
      12. Click Edit button
      13. Make sure the Group event type is selected, the course is set to c2 and and the group field is set to g4.
      14. Expand group field and set to g3 and save.
      15. Click on the event and make sure it displays Group event type and now the group is g3
      Group event type functionality testing on course context
      1. In the t1 tab, go to c1, turn editing mode on and add the calendar block
      2. On the calendar block, click on the current month link, should be July.
      3. On the calendar, click New event button.
      4. Note course is selected in event type field and the course field is set to c1
      5. Change the event type to Group.
      6. Make sure the course field is also set to c1 and the group field displays g1 and g2
      7. Select g1, fill the rest of the form and save.
      8. Make sure the event was created.
      9. Click on the event and make it displays group event type and the group is g1
      10. Edit the event, make sure group event type is selected and the group is set to g1.
      11. Change the group to g2 and save.
      12. Click on the event, make sure it is a group and event and the group displayed is g2.
      Group capability testing
      1. Log in as s1, go to calendar and click New event button.
      2. Make sure the Type of event is set to User and it is displayed as a text and not as a drop down.
        • In the admin tab, go to Site administration > Users > Permissions > Define roles and click in the cog to edit Student role.
        • Search for moodle/calendar:manageentries click on Allow check box and save.
      3. Back to s1 tab, reload the month view and click New event button.
      4. Make sure {Type of event field now displays two options: User and Course options
      5. You should be able to select c1 or c2 in the course field by focusing on the field and pressing down on the keyboard.
      6. Select c1 course, fill the rest of the form and save.
      7. Make sure the event was created and the correct information is displayed in the event summary.
        • In the admin tab, edit Student role again and this time assign 'moodle/site:accessallgroups' and 'moodle/course:managegroups' capability to student role.
      8. Back to s1 tab, reload the calendar and click New event button.
      9. Make sure you can now see Group option in the Type of event field.
      10. Select c1 course and g2 group and save.
      11. Click on the event, make sure it is a group and event and the group displayed is g2.
      Group event type should not list courses without groups.
      1. Log in as t1 and go to calendar.
      2. Click New event button and select Group event type.
      3. Focus on the course field and press arrow down key.
      4. You should not see c3 course in the list.
        • In the admin tab, go to c3 and add 2 groups g5 and g6 and purge caches.
        • Go to course c3 participants page and enrol t1 user as teacher.
      5. In the t1 tab, reload the calendar page.
      6. Click New event button and select Group event type.
      7. Focus on the course field and press arrow down key.
      8. Make sure you now have c3 option on the course field.
      9. Fill the form, select c3, group g5 and create the event.
      10. Make sure the event was created and the information on the summary modal is correct.
      11. Click Edit to edit the event and change group to g6 and save.
      12. Click on the event title and make sure the event group has changed to g6
      Manage subscription group testing.
      1. As t1 go to Calendar and click Manage subscription button on the bottom.
      2. Make sure the event type field displays User, Course and Group options.
      3. Fill the form, select Calendar file (.ics) if you need a subscription file use the one located in calendar/tests/fixture/import.ics
      4. Make sure you don't get any errors while importing the ICS file.
      5. Using the left arrow change the months to February of 2017.
      6. Make sure it displays 2 created events in that month
      Memory exception error testing (will be tested by Integration team)
      1. Download the attached script and save on your moodle root folder.
      2. On a terminal, go to the root folder and run the script php create_courses.php c
      3. Login as admin.
      4. Go to Site administration > Appearance > Calendar
      5. Enable Admins see all adminseeall setting.
      6. Go to Calendar and click New event button.
      7. The event form should render and it should not display Memory exhaustion errors.
      Show
      Setup Create a fresh install. Login as admin Create 3 courses c1 , c2 and c3 setting the start date to few days in the past (at least 2 days) Enrol a teacher t1 and a student s1 in c1 and c2 Default group visibility testing. Open the site in incognito mode and login as t1 Go to Calendar and click New event button. Make sure you see *User and Course in the Type of event drop down*. You should NOT  see Group in the event type drop down Fill the form and select event type course and select c1 in the course field and save. Make sure the event was created Click on the event title and make sure the information displayed is correct in the event summary. Group event type functionality testing on site context In the admin tab, create 4 groups g1 and g2 in c1 and g3 and g4 in c2 . In the teacher tab, reload the month view and click New event button again. Make sure the event type drop down now has also Group option. Please note: there’s a existing bug on the group field, where it doesn't display the field as disabled. For more info see MDL-XXXX Fill the form and select Group event type and select c1 in the course field. Make sure the group field displays g1 and g2 IMPORTANT: If the group field looks disable or doesn't show groups, please purge your caches . Change to c2 in the course field. Make sure group field options now changed to g3 and g4 Choose g4 in the group field and save. Please note, the group event is not visible yet, on the month view change Detailed month view for field to c2 Make sure the event was created. Click on the event. Make sure the event type displayed is Group and the group is g4 Click Edit button Make sure the Group event type is selected, the course is set to c2 and and the group field is set to g4 . Expand group field and set to g3 and save. Click on the event and make sure it displays Group event type and now the group is g3 Group event type functionality testing on course context In the t1 tab, go to c1 , turn editing mode on and add the calendar block On the calendar block, click on the current month link, should be July . On the calendar, click New event button. Note course is selected in event type field and the course field is set to c1 Change the event type to Group . Make sure the course field is also set to c1 and the group field displays g1 and g2 Select g1 , fill the rest of the form and save. Make sure the event was created. Click on the event and make it displays group event type and the group is g1 Edit the event, make sure group event type is selected and the group is set to g1 . Change the group to g2 and save. Click on the event, make sure it is a group and event and the group displayed is g2 . Group capability testing Log in as s1 , go to calendar and click New event button. Make sure the Type of event is set to User and it is displayed as a text and not as a drop down. In the admin tab, go to Site administration > Users > Permissions > Define roles and click in the cog to edit Student role. Search for moodle/calendar:manageentries click on Allow check box and save. Back to s1 tab, reload the month view and click New event button. Make sure { Type of event field now displays two options: User and Course options You should be able to select c1 or c2 in the course field by focusing on the field and pressing down on the keyboard. Select c1 course, fill the rest of the form and save. Make sure the event was created and the correct information is displayed in the event summary. In the admin tab, edit Student role again and this time assign 'moodle/site:accessallgroups' and 'moodle/course:managegroups' capability to student role. Back to s1 tab, reload the calendar and click New event button. Make sure you can now see Group option in the Type of event field. Select c1 course and g2 group and save. Click on the event, make sure it is a group and event and the group displayed is g2 . Group event type should not list courses without groups. Log in as t1 and go to calendar. Click New event button and select Group event type. Focus on the course field and press arrow down key. You should not see c3 course in the list. In the admin tab, go to c3 and add 2 groups g5 and g6 and purge caches. Go to course c3 participants page and enrol t1 user as teacher. In the t1 tab, reload the calendar page. Click New event button and select Group event type. Focus on the course field and press arrow down key. Make sure you now have c3 option on the course field. Fill the form, select c3 , group g5 and create the event. Make sure the event was created and the information on the summary modal is correct. Click Edit to edit the event and change group to g6 and save. Click on the event title and make sure the event group has changed to g6 Manage subscription group testing. As t1 go to Calendar and click Manage subscription button on the bottom. Make sure the event type field displays User , Course and Group options. Fill the form, select Calendar file (.ics) if you need a subscription file use the one located in calendar/tests/fixture/import.ics Make sure you don't get any errors while importing the ICS file. Using the left arrow change the months to February of 2017 . Make sure it displays 2 created events in that month Memory exception error testing (will be tested by Integration team) Download the attached script and save on your moodle root folder. On a terminal, go to the root folder and run the script php create_courses.php c Login as admin. Go to Site administration > Appearance > Calendar Enable Admins see all adminseeall setting. Go to Calendar and click New event button. The event form should render and it should not display Memory exhaustion errors.

      As admin on a large site (50k users, 50k courses), if I click an empty day in the calendar, or go to edit and existing event, the modal opens, but I'm shortly greeted with a empty 'undefined' error box. The server respond to the ajax request with a 500 or 503 code. 

      Looking at the logs, I get:

      [15-Nov-2017 17:09:05 America/Detroit] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/moodlemajor/lib/dml/pgsql_native_moodle_database.php on line 794
       
      [15-Nov-2017 17:09:05 America/Detroit] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 12288 bytes) in /var/www/html/moodlemajor/lib/classes/session/manager.php on line 530
      

      I haven't done any digging into the cause yet, but I assume that somewhere in the code is doing too much with the fact that I am an admin with access to 50k courses, when it isn't needed to show the New event dialog box.

       

      For completeness, the ajax request that causes this error is:

      https://test.xyz.edu/lib/ajax/service.php?sesskey=ZZZZZZZZZZ&info=core_get_fragment

      With a body of:

      [{"index":0,"methodname":"core_get_fragment","args":{"component":"calendar","callback":"event_form","contextid":2836,"args":[{"name":"starttime","value":"1510783266"},{"name":"courseid","value":1}]}}]
      

       

        1. create_courses.php
          2 kB
        2. MDL-60826.xlsx
          14.29 MB
        3. MDL-60826 (p2).xlsx
          17.82 MB

            lameze Simey Lameze
            emerrill Eric Merrill
            Shamim Rezaie Shamim Rezaie
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            26 Vote for this issue
            Watchers:
            36 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 30 minutes
                1h 30m

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