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

Serious performance regression in course reset of groups, including race condition that may send erroneous emails to students

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 2.6
    • 2.6
    • Groups, Quiz
    • MOODLE_26_STABLE
    • MOODLE_26_STABLE
    • MDL-41726-master-2nd
    • Hide

      Test pre-requisites

      1. Create some groups (A, B), and add some users to the group
        • 2 member of group A (let's call them M1, M2)
        • 2 not being in a group (let's call them M3, M4)
      2. Create a quiz with a close date set (in the future)
      3. Add a group override of group A that removes the close date
      4. Open the quiz page logged in as the above users to observe if a closed date is mentioned.
        • You can confirm that M3 and M4 have a closed date, M1 and M2 don't.

      Test 1

      1. Now add M3 to group A
        • Make sure M3 inherited the new override (no close date)
      2. Remove M1 from group A
        • Make sure M1 inherited the new override (now has a closed date)
      3. Delete group A
        • Make sure M2 and M3 inherited the new override (now has a closed date)

      Test 2

      1. Re-set the environment according to the test-prerequisites
      2. Perform a course reset, only select Remove all group members.
      3. Make sure M1 and M2 inherited the override (now have a closed date)

      Test 3

      1. Re-set the environment according to the test-prerequisites
      2. Perform a course reset, only select Delete all groups.
      3. Make sure M1 and M2 inherited the override (now have a closed date)
      Show
      Test pre-requisites Create some groups (A, B), and add some users to the group 2 member of group A (let's call them M1, M2) 2 not being in a group (let's call them M3, M4) Create a quiz with a close date set (in the future) Add a group override of group A that removes the close date Open the quiz page logged in as the above users to observe if a closed date is mentioned. You can confirm that M3 and M4 have a closed date, M1 and M2 don't. Test 1 Now add M3 to group A Make sure M3 inherited the new override (no close date) Remove M1 from group A Make sure M1 inherited the new override (now has a closed date) Delete group A Make sure M2 and M3 inherited the new override (now has a closed date) Test 2 Re-set the environment according to the test-prerequisites Perform a course reset, only select Remove all group members . Make sure M1 and M2 inherited the override (now have a closed date) Test 3 Re-set the environment according to the test-prerequisites Perform a course reset, only select Delete all groups . Make sure M1 and M2 inherited the override (now have a closed date)
    • 100
    • BACKEND Sprint 5

      Steps to reproduce

      1. Create a large course, say with 10,000 users, a few dozen groups each with a few thousand members, and several quizzes. (The OU has courses this big.)
      2. Time doing a course reset to remove all group members. (Also look at the DB query count in the footer.)

      Do this for Moodle versions both before and after MDL-39958 was integrated. (Note that MDL-39958 was committed with MDL-39959 is the issue id in the commit comment.)

      That is the perofrmance problem. Now the nasty race condition.

      1. Work out which order $DB->get_recordset('groups', array('courseid' => $courseid)); in groups_delete_group_members, in particular identify which goup will be deleted first, and which last.
      2. For one quiz, set Time limits as follows:
        • Quiz closes: Now + 1 day
        • Quiz closes group override for last group to be processed: Now - 1 day
        • Quiz closes group override for first group to be processed: Now + 1 day
      3. Set the quiz to have attempts become overdue when time expires, and to send an email notification to student when this happens.
      4. Start an attempt as one student that is a member of both those groups. Answer some questions but don't submit.
      5. Now, try to work out when cron will next run, and just beofre that, do a course reset to remove all the group members, Now also need to be between T + 1 minute and T + 1 day.

      Expected result: The student does not get a notification, because initially the close date is Now + 1 day, and when they are removed from both groups it is Now + 1 day.

      Possible result:
      Cron runs between time the student is removed from the first group, and the time they are removed from the last group. Hence cron sees them as due to submit T - 1 day ago, and so makes their attempt overdue, and sends them an incorrect email.

            fred Frédéric Massart
            timhunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rossiani Wijaya Rossiani Wijaya
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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