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

Viewing question bank in quiz may timeout

XMLWordPrintable

    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MDL-50798-master
    • 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"

      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.

            emerrill Eric Merrill
            emerrill Eric Merrill
            Tim Hunt Tim Hunt
            Dan Poltawski Dan Poltawski
            Adrian Greeve Adrian Greeve
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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