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

Unable to add multiple quiz questions, due to race condition

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 3.7.5, 3.8.2, 3.9
    • Fix Version/s: None
    • Component/s: Questions, Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE

      Description

      This issue has been revealed as part of MDL-67540 investigation.

      Steps to replicate:

      1. Login as an admin (session 1).
      2. Create a course.
      3. Create a quiz.
      4. Add 2 questions to question bank (`question 1` and `question 2`).
      5. In order to simulate race condition hack the code and add `sleep(2);` here: https://github.com/moodle/moodle/blob/9df4a4de18ace8fa1e02b93d6f0e572fa20ef1a2/mod/quiz/locallib.php#L2160
      6. Open another browser tab in incognito mode and login as an admin (session 2).
      7. In both sessions navigate to the quiz.
      8. Click `Edit quiz`.
      9. Click `Add` -> `From question bank`.
      10. In session 1 tick `question 1`.
      11. In session 2 tick `question 2`.
      12. In both sessions click `Add selected questions to the quiz` at the same time.
      13. Confirm, that one session adds the questions and another fails due to `mdl_quizslot_quislo_uix` constraint.

        Attachments

        1. Race_1.jpg
          Race_1.jpg
          137 kB
        2. Race_2.jpg
          Race_2.jpg
          150 kB

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              mikhailgolenkov Mikhail Golenkov
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: