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

Regrade can get stuck in infinite loop

    XMLWordPrintable

    Details

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                11 Vote for this issue
                Watchers:
                27 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Mar/19

                  Time Tracking

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