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

course_modinfo does not check whether a lock has been successfully acquired

XMLWordPrintable

    • MOODLE_401_STABLE

      Since upgrading to Moodle 4.1, our error.log has a lot of entries with the following error message:
      Coding error detected, it must be fixed by a programmer: You must acquire a lock on the course ID before calling inner_build_course_cache

      The class course_modinfo calls $cache->acquire_lock without checking its return value (in build_course_cache, purge_course_section_cache_by_id, purge_course_section_cache_by_number and purge_course_module_cache). $cache->acquire_lock does not block until the lock has been successfully acquired.

      I think, cache_loader_with_locking should be adapted and acquire_lock should (optionally) block until the lock has been successfully acquired. Cache locks (implementing cache_lock_interface) already support blocking. However, by default cachelock_file randomly waits between 100 and 5000 ms at most, which is quite short.

            Unassigned Unassigned
            mgauk Martin Gauk
            Votes:
            20 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:

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