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

Recursion and unhelpful lock exception in course modinfo

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.7.3, 3.8
    • Course
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MDL-67405-master
    • Hide

      First, revert changes from MDL-66936

      • Create a course
      • Add an instance of URL resource, open "URL variables" section and add any variable
      • As an admin go to Site administration>Plugins>Filters>Manage filters and enable "Glossary auto linking" filter for content and heading
      • Purge caches
      • Open the course page - you should see debugging message about recursion but still see the course
      Show
      First, revert changes from MDL-66936 Create a course Add an instance of URL resource, open "URL variables" section and add any variable As an admin go to Site administration>Plugins>Filters>Manage filters and enable "Glossary auto linking" filter for content and heading Purge caches Open the course page - you should see debugging message about recursion but still see the course

      This is very big issue, a simple course with all-core modules makes a course totally unusable - course cache can not be built and course can not be displayed to anybody. get_fast_modinfo() is called recursively and it dies when trying to get the lock so it is also impossible to find what caused it. Related issues MDL-33810 and MDL-66936 explain relevant problems (not so critical) but the best solution will be to prevent the recursion in modinfolib.php

      Edit: the reason for recursion was fixed in MDL-66936, it needs to be reverted to reproduce this problem

      • Create a course
      • Add an instance of URL resource, open "URL variables" section and add any variable
      • As an admin go to Site administration>Plugins>Filters>Manage filters and enable "Glossary auto linking" filter for content and heading
      • Purge caches
      • Open the course page - depending on db/lock config you either get out-of-memory or "unable to obtain a lock"

      This happens because get_fast_modinfo() is called recursively. I will comment on linked issues suggesting some changes there but even if we fix them, the recursion needs to be prevented.

      Simple recursion detection code around line 457 of lib/modinfolib.php will show this backtrace:

       Coding error detected, it must be fixed by a programmer: recursion
      Debug info:
      Error code: codingerror
      Stack trace:
       
          line 459 of /lib/modinfolib.php: coding_exception thrown
          line 418 of /lib/modinfolib.php: call to course_modinfo->__construct()
          line 2174 of /lib/modinfolib.php: call to course_modinfo::instance()
          line 163 of /mod/glossary/classes/local/concept_cache.php: call to get_fast_modinfo()
          line 279 of /mod/glossary/classes/local/concept_cache.php: call to mod_glossary\local\concept_cache::get_course_concepts()
          line 79 of /filter/glossary/filter.php: call to mod_glossary\local\concept_cache::get_concepts()
          line 163 of /filter/glossary/filter.php: call to filter_glossary->get_all_concepts()
          line 176 of /lib/filterlib.php: call to filter_glossary->filter()
          line 232 of /lib/filterlib.php: call to filter_manager->apply_filter_chain()
          line 377 of /lib/filterlib.php: call to filter_manager->filter_string()
          line 1488 of /lib/weblib.php: call to performance_measuring_filter_manager->filter_string()
          line 463 of /mod/url/locallib.php: call to format_string()
          line 109 of /mod/url/locallib.php: call to url_get_variable_values()
          line 247 of /mod/url/lib.php: call to url_get_full_url()
          line 469 of /course/lib.php: call to url_get_coursemodule_info()
          line 676 of /lib/modinfolib.php: call to get_array_of_activities()
          line 468 of /lib/modinfolib.php: call to course_modinfo::inner_build_course_cache()
          line 418 of /lib/modinfolib.php: call to course_modinfo->__construct()
          line 2174 of /lib/modinfolib.php: call to course_modinfo::instance()
          line 163 of /mod/glossary/classes/local/concept_cache.php: call to get_fast_modinfo()
          line 279 of /mod/glossary/classes/local/concept_cache.php: call to mod_glossary\local\concept_cache::get_course_concepts()
          line 79 of /filter/glossary/filter.php: call to mod_glossary\local\concept_cache::get_concepts()
          line 163 of /filter/glossary/filter.php: call to filter_glossary->get_all_concepts()
          line 176 of /lib/filterlib.php: call to filter_glossary->filter()
          line 232 of /lib/filterlib.php: call to filter_manager->apply_filter_chain()
          line 377 of /lib/filterlib.php: call to filter_manager->filter_string()
          line 1488 of /lib/weblib.php: call to performance_measuring_filter_manager->filter_string()
          line 1233 of /lib/pagelib.php: call to format_string()
          line 240 of /course/view.php: call to moodle_page->set_title()
      

            Unassigned Unassigned
            marina Marina Glancy
            Votes:
            4 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 4 hours, 31 minutes
                1d 4h 31m

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