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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.6, 3.7, 3.8
    • Fix Version/s: 3.8
    • Component/s: Global search
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull Master Branch:
      master-MDL-66805-search

      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

              • Assignee:
                kristianr Kristian Ringer
                Reporter:
                kristianr Kristian Ringer
                Peer reviewer:
                Brendan Heywood
                Integrator:
                Eloy Lafuente (stronk7)
                Tester:
                Eloy Lafuente (stronk7)
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/19

                  Time Tracking

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