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

Viewing question bank in quiz may timeout

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.7, 2.9.1
    • Fix Version/s: 2.8.8, 2.9.2
    • Component/s: Questions, Quiz
    • Labels:
    • Testing Instructions:
      Hide

      You will need a question bank with at least 1000 questions. I have supplied an attached Moodle XML file that you can import: 1100-questions.xml

      On my own dev machine, I had to slow down the rendering to trigger a timeout. To do this, I added this code to the foreach block in question/classes/bank/view.php display_question_list() (around line 707):

                  $t = 1;
                  for ($i = 1; $i < 1000000; $i++) {
                      $t = $t + 1;
                      $t = $t * 5;
                      $t = $t / 3;
                  }
      

      (Note that sleep() won't work, because it is excluded from timeouts)

      1. Comment out the \core_php_time_limit::raise(300); line from this patch
      2. Go into the question bank, and view the category will the 1000+ questions
        • If it is set to 20 per page, click "show all" at the bottom
      3. Confirm that the page times out
        • If it does not, fiddle with the slowdown code to make it take longer
      4. Uncomment the \core_php_time_limit::raise(300); line from this patch
      5. Reload the question bank page
      6. Confirm the page doesn't timeout
        • If the page times out, at 5 minutes, then the slowdown code is too slow, try tuning it back some
      7. Go into a Quiz, Edit quiz
      8. Click Add > from question bank
      9. Confirm the popup box populates without timing out
        • Switch to the category with the 1000+ questions if needed, and confirm it is still on "show all"
      Show
      You will need a question bank with at least 1000 questions. I have supplied an attached Moodle XML file that you can import: 1100-questions.xml On my own dev machine, I had to slow down the rendering to trigger a timeout. To do this, I added this code to the foreach block in question/classes/bank/view.php display_question_list() (around line 707): $t = 1; for ( $i = 1; $i < 1000000; $i ++) { $t = $t + 1; $t = $t * 5; $t = $t / 3; } (Note that sleep() won't work, because it is excluded from timeouts) Comment out the \core_php_time_limit::raise(300); line from this patch Go into the question bank, and view the category will the 1000+ questions If it is set to 20 per page, click "show all" at the bottom Confirm that the page times out If it does not, fiddle with the slowdown code to make it take longer Uncomment the \core_php_time_limit::raise(300); line from this patch Reload the question bank page Confirm the page doesn't timeout If the page times out, at 5 minutes, then the slowdown code is too slow, try tuning it back some Go into a Quiz, Edit quiz Click Add > from question bank Confirm the popup box populates without timing out Switch to the category with the 1000+ questions if needed, and confirm it is still on "show all"
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull Master Branch:
      MDL-50798-master

      Description

      We are seeing a problem where if a user has a lot of questions, and has the question bank set to "view all" (which is really view 1000), the page times out (this will of course be dependent on system performance and such.

      We noticed, that it doesn't timeout in the question bank itself in our case. I believe it's because the quiz has to use an output buffer (ob_) to catch the questionbank renderer output, which slows down the overall rendering.

        Attachments

          Activity

            People

            • Assignee:
              emerrill Eric Merrill
              Reporter:
              emerrill Eric Merrill
              Peer reviewer:
              Tim Hunt
              Integrator:
              Dan Poltawski
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/15