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

Search: Cron error indexing sections in some cases

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Install a new Moodle 3.5 (or Master)
      2. Create a new course with the course format as topics
      3. Turn editing mode on for that course
      4. Edit topic 1
      5. Enter in a custom topic name
      6. Enter some topic description text
      7. Click save and display
      8. As an administrator enable Global Search for the site with simple search as the search engine
      9. From the command line for the site manually run 'php search/cli/indexer.php'

      Expected behavior:

      Index task should complete with out errors

      Bug behavior:

      Index task fails with a PHP exception of the course sections index sub task

      Show
      Install a new Moodle 3.5 (or Master) Create a new course with the course format as topics Turn editing mode on for that course Edit topic 1 Enter in a custom topic name Enter some topic description text Click save and display As an administrator enable Global Search for the site with simple search as the search engine From the command line for the site manually run 'php search/cli/indexer.php' Expected behavior: Index task should complete with out errors Bug behavior: Index task fails with a PHP exception of the course sections index sub task
    • Workaround:
      Hide

      Disabling the Course - sections search are via the admin UI stops the error from occurring. It also stops that are from being indexed

      Show
      Disabling the Course - sections search are via the admin UI stops the error from occurring. It also stops that are from being indexed
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull 3.5 Branch:
      MDL-62713-m35
    • Pull Master Branch:
      MDL-62713-master

      Description

      I run my cron via web browser using a password and an online cron service (cron-job.org).

      After upgrading to Moodle 3.5, I implemented the global search feature using the new "Simple search" search engine. Now whenever I delete an activity or resource in a course, thus sending it to the recycle bin, the next time the "Global search indexing" task (\core\task\search_index_task) runs, I get the following cron output:
      ______________________________________________________________
      Recently fetched info about available updates is still fresh enough, skipping.
      Processing area: Assignment - activity information
      No new documents to index.
      Processing area: External tool - activity information
      No new documents to index.
      Processing area: Messages - sent
      No new documents to index.
      Processing area: Messages - received
      No new documents to index.
      Processing area: Course sections
      !!! Exception - Call to undefined function core_course\search\get_section_name() !!!

      Fatal error: Uncaught coding_exception: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
      C:\xampp\moodle\lib\classes\task\manager.php on line 520

      Code should look like:

      $factory = \core\lock\lock_config::get_lock_factory('type');
      $lock = $factory->get_lock(Resource id #248);
      $lock->release(); // Locks must ALWAYS be released like this.

      in C:\xampp\moodle\lib\classes\lock\lock.php:117
      Stack trace:
      #0 [internal function]: core\lock\lock->__destruct()
      #1 {main}
        thrown in C:\xampp\moodle\lib\classes\lock\lock.php on line 117
      _________________________________________________________________

      This persists and no scheduled tasks run, until I manually run the "Global search indexing" task from the Site admin page using the "Run now" link.

      To reproduce the error:

      1. Deselect site setting "Cron execution via command line only".
      2. Enable Global search.
      3. Select the Simple search search engine.
      4. Run the initial indexing.
      5. Delete an activity or resource from a course (I typically duplicate a label and then delete it).
      6. Execute the cron from a web browser.
        1. At this point, I should and do get a normal cron output.
      7. Wait until the "Global search indexing" task runs.
      8. Execute the cron from a web browser.
        1. Again, I should get normal cron output, but instead get the error above.
      9. Go to the Scheduled tasks in site administration.
      10. Execute the "Global search indexing" task via the "Run now" link.
      11. Execute the cron from a web browser.
        1. At this point, I should and do get a normal cron output.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                quen Sam Marshall
                Reporter:
                amjohnson46 Aaron M Johnson
                Peer reviewer:
                Tim Hunt
                Integrator:
                David Monllaó
                Tester:
                Janelle Barcega
                Participants:
                Component watchers:
                Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jul/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 20 minutes
                  20m