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

If a cache is used during the initialisation or updating of the cache config file you get a fatal error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.4.1, 2.5
    • Fix Version/s: 2.4.2
    • Component/s: Caching
    • Labels:
    • Testing Instructions:
      Hide
      1. Upgrade a site.
      2. Perform a fresh install.
      3. Repeat both through CLI.
      4. Run unit tests.
      5. Apply the patch attached to this file called "testing.patch"
      6. Browse to your site.
      7. You'll get a debug notice about missing definition and you should have bumped version. Ignore that.
      8. On the first page you browse you should get a "adhoc/plugintypes"
      9. Refresh the page.
      10. Make sure you get a "core/plugintypes"
      11. Make sure you get no errors.
      Show
      Upgrade a site. Perform a fresh install. Repeat both through CLI. Run unit tests. Apply the patch attached to this file called "testing.patch" Browse to your site. You'll get a debug notice about missing definition and you should have bumped version. Ignore that. On the first page you browse you should get a "adhoc/plugintypes" Refresh the page. Make sure you get a "core/plugintypes" Make sure you get no errors.
    • Workaround:
      Hide

      Dance like you want to.

      Show
      Dance like you want to.
    • Difficulty:
      Difficult
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull Master Branch:
      wip-MDL-37545-m25

      Description

      As quoted from David Mudrak's comment on MDL-34224:

      Sam, I have a question for you. While working on MDL-34401 I am trying to implement a cache to be used inside get_plugin_list(). According to my experiments, it decreases the Wall time spent in this function (as measured by xhprof) significantly. Using an ad-hoc cache worked great. So I wanted to convert it to a cache with proper definition. But ... The problem is that get_plugin_list() is called very early in the setup process and I can't find a way how to detect the case that the cache's description has not been registered yet. I am suspecting we will need to completely disable the whole MUC immediately after we realize that
      if ($version > $CFG->version) { // upgrade
      in admin/index.php.
      In other words, my problem is that I have a code
      $cache = cache::make('core', 'pluginlist');
      that gets called before the core registers the description of this cache (simply because the cache API uses this function while it's looking for descriptions...).
      Any ideas?

      This highlights an issue within the cache API.
      Internally it uses the plugin API in order to find definitions presented by plugins.
      A very necessary procedure.

      David above was looking to implement a plugins cache, a cache that would be very worth while. Because the cache uses the plugins API internally during initialisation unfortunately he ends up in a state where the cache get stuck in a loop continually trying to reinitialise itself.
      The problem comes because part way through the initialisation the plugins API is called, the plugins API makes a cache and as part of that process we try to initialise again.

      The solution to this I believe is to make use of an ad-hoc cache if a cache has been requested that we don't know about while the cache API itself is currently initialising.
      In order to implement this we'll need a new state "updating" and better handling of requests to create a cache (this is where initialisation starts to happen).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Mar/13