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

Search index.php should not lock the session during a search

    XMLWordPrintable

Details

    • MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • MOODLE_38_STABLE
    • master-MDL-66805-search
    • Hide

      1) You will need a database with a lot of data that leads to a long search time. Or you can cheat and just sleep() in whatever engine you are using:

      --- a/search/engine/simpledb/classes/engine.php
      +++ b/search/engine/simpledb/classes/engine.php
      @@ -54,6 +54,8 @@ class engine extends \core_search\engine {
       public function execute_query($filters, $usercontexts, $limit = 0) {
       global $DB, $USER;
       
      +sleep(5);

      2) Load two search pages in two tabs /search/index.php and search at the same time.

      3) While the searches are completing the second page should not be blocked. ie with a 5 second sleep, the second search should take 5 seconds, not 10 seconds.

      Show
      1) You will need a database with a lot of data that leads to a long search time. Or you can cheat and just sleep() in whatever engine you are using: --- a/search/engine/simpledb/classes/engine.php +++ b/search/engine/simpledb/classes/engine.php @@ - 54 , 6 + 54 , 8 @@ class engine extends \core_search\engine { public function execute_query($filters, $usercontexts, $limit = 0 ) { global $DB, $USER; +sleep( 5 ); 2) Load two search pages in two tabs /search/index.php and search at the same time. 3) While the searches are completing the second page should not be blocked. ie with a 5 second sleep, the second search should take 5 seconds, not 10 seconds.

    Description

      Some searches can take a while to complete. If a user opens another tab and tries to do multiple searches at once, they can receive session lock errors. We don't need to be locking the session on a search.

      The best way to solve this issue would be after this tracker lands: https://tracker.moodle.org/browse/MDL-58018

      and implementing a READ_ONLY_SESSION . Until then, the idea is to just end the session as quickly as possible in search/index.php to avoid these issues.

      Attachments

        Issue Links

          Activity

            People

              kristianr Kristian Ringer
              kristianr Kristian Ringer
              Brendan Heywood Brendan Heywood
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 10 minutes
                  10m

                  Clockify

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