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

Bad cache configuration file generated when file system flaky

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.8.10, 2.9.4, 3.0.2
    • 2.9.6, 3.0.4
    • Caching
    • MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_29_STABLE, MOODLE_30_STABLE
    • Hide
      1. Ensure that you have a cache config file ([moodledata]/muc/config.php)
      2. In cache/classes/config.php, add sleep(20); to the cache_config::include_configuration() method immediately before the include($cachefile); line
      3. Go to the cache configuration page
      4. While the script is sleeping, delete the cache config file
      5. Once the page loads, confirm that you see an error message and that no invalid new cache config file has been generated
      6. Remove the sleep() call and reload the cache config page
      7. Confirm that a valid default cache config file has been generated (with 3 stores and a non-null siteidentifier etc.)

      (The same steps can be used to reproduce the problem on a codebase without the patch.)

      Show
      Ensure that you have a cache config file ( [moodledata] /muc/config.php) In cache/classes/config.php, add sleep(20); to the cache_config::include_configuration() method immediately before the include($cachefile); line Go to the cache configuration page While the script is sleeping, delete the cache config file Once the page loads, confirm that you see an error message and that no invalid new cache config file has been generated Remove the sleep() call and reload the cache config page Confirm that a valid default cache config file has been generated (with 3 stores and a non-null siteidentifier etc.) (The same steps can be used to reproduce the problem on a codebase without the patch.)

    Description

      If there are temporary problems with the data directory filesystem it is possible to have a "null" cache configuration file generated. This is a valid configuration (in that it contains the correct structures) but it contains no store definitions or mappings. This causes Moodle to use cachestore_dummy.

      The scenario that causes this appears to be the file system dropping out momentarily during cache_config::include_configuration(), after the file_exists() check but before the include(), then reappearing in time for the new config file to be written. This seems like an extremely unlikely situation but we have seen this happen on our live system yesterday.

      The problem can be simulated using these steps:

      1. Ensure you have a valid cache configuration file
      2. Comment out the include($cachefile) line in cache_config::include_configuration()
      3. Go to a Moodle page. If you have debugging switched on you will see messages about "Your cache configuration file is out of date and needs to be refreshed"
      4. Look at your cache configuration file. It should now have "unknown" as the site identifier and no stores or mappings set up

      Attachments

        Issue Links

          Activity

            People

              maherne Michael Aherne
              maherne Michael Aherne
              Andrew Lyons Andrew Lyons
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Adrian Greeve Adrian Greeve
              Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/May/16