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

Regrade can get stuck in infinite loop

XMLWordPrintable

    • MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • MOODLE_35_STABLE, MOODLE_36_STABLE
    • MDL-64609-master
    • Hide
      1. Go into a course (can be new) with at least one student
      2. Go to Gradebook setup
      3. Add a new Grade Item, give it an ID Number of g1
      4. Add a new Grade Item
      5. Add a category
      6. Edit the category calculation and set it to =[[g1]]
      7. Delete grade item 1 (g1)
      8. Confirm that the page loads.

      Separately, use a course with grades and confirm that regrades seem to happen correctly. Like deleting a graded item in the course, and totals updating correctly.

      Show
      Go into a course (can be new) with at least one student Go to Gradebook setup Add a new Grade Item, give it an ID Number of g1 Add a new Grade Item Add a category Edit the category calculation and set it to  =[ [g1] ] Delete grade item 1 (g1) Confirm that the page loads. Separately, use a course with grades and confirm that regrades seem to happen correctly. Like deleting a graded item in the course, and totals updating correctly.

      We noticed after upgrading to 3.5.4 last night, a number of pages getting permanently stuck on the servers, drawing 100% CPU, and locking user sessions. We traced it to the calendar, which then traced to regrading (the callback to Assign events in the calendar checks grades, which can trigger an entire course regrade...).

      From there I narrowed it down to the change made in MDL-63761.

      Look at the code change here for this to make sense https://github.com/moodle/moodle/commit/e607001e7eb7dddb1216b99bf010eb0d435a2c43

      But basically, the change from $count to just checking the count of $finalids to check for a failure does not work.

      The problem is that the counter checking for failure needs to be reset each time through the outer while (count($finalids) < count($gids)) loop, but that doesn't happen when we are just using $finalids to check. So in the case I am debugging, the outer loop stabilizes at while (23 < 24), and so never finishes.

      This makes me think that the suggested fix in the opening to MDL-63761 (adding an additional $count++) may be the correct solution here, not the removal of $count.

      I'm still working to narrow down the exact scenario that causes the loop to happen.

            emerrill Eric Merrill
            emerrill Eric Merrill
            Jake Dallimore Jake Dallimore
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Janelle Barcega Janelle Barcega
            Votes:
            11 Vote for this issue
            Watchers:
            28 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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