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

Fix statcache race condition in cachestore_file

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-79185-MOODLE_401_STABLE
    • MDL-79185-MOODLE_403_STABLE
    • MDL-79185-master
    • Hide

      It's tricky to test this patch. You'd need xdebug enabled in your test set up.

      1. Have a moodle  with a default caching settings 
      2. Enable debugging by adding $CFG->debug = (E_ALL | E_STRICT);  and  $CFG->debugdisplay = 1; to your config.php
      3. In your IDE stop execution of the script at line 427 of cache/stores/file/lib.php
      4. Navigate to /course/management.php with edebug in debugging mode, in your IDE it will stop on the line 427, copy value of $file variable (don't continue)
      5. In my case the value is /var/lib/sitedata/cache/cachestore_file/default_application/core_config/939-cache/939654e0580e0b66899e27f8c9b24bf5e490488f.cache
      6. On my dev box edit a content of this file and remove everything, then save file.
      7. Continue the script execution so it could fail at line  569 of cache/stores/file/lib.php
      8. Confirm that no exception is thrown and you can load the page successfully, but see following debugging errors:
        Can not read data from cache file: /var/lib/sitedata/cache/cachestore_file/default_application/core_config/939-cache/939654e0580e0b66899e27f8c9b24bf5e490488f.cache
        Failed to unserialise data from cache file: /var/lib/sitedata/cache/cachestore_file/default_application/core_config/939-cache/939654e0580e0b66899e27f8c9b24bf5e490488f.cache. Data:
      Show
      It's tricky to test this patch. You'd need xdebug enabled in your test set up. Have a moodle  with a default caching settings  Enable debugging by adding $CFG->debug = (E_ALL | E_STRICT);  and  $CFG->debugdisplay = 1; to your config.php In your IDE stop execution of the script at line 427 of cache/stores/file/lib.php Navigate to /course/management.php with edebug in debugging mode, in your IDE it will stop on the line 427, copy value of $file variable (don't continue) In my case the value is /var/lib/sitedata/cache/cachestore_file/default_application/core_config/939-cache/939654e0580e0b66899e27f8c9b24bf5e490488f.cache On my dev box edit a content of this file and remove everything, then save file. Continue the script execution so it could fail at line  569 of cache/stores/file/lib.php Confirm that no exception is thrown and you can load the page successfully, but see following debugging errors: Can not read data from cache file: /var/lib/sitedata/cache/cachestore_file/default_application/core_config/939-cache/939654e0580e0b66899e27f8c9b24bf5e490488f.cache Failed to unserialise data from cache file: /var/lib/sitedata/cache/cachestore_file/default_application/core_config/939-cache/939654e0580e0b66899e27f8c9b24bf5e490488f.cache. Data:

      Currently if something is wrong with file cache data it throws an exception here https://github.com/moodle/moodle/blob/master/cache/stores/file/lib.php#L557

      But in real life this error is useless and can't give you anything for debugging. 

      I'd like to see at least file path exposed.

        1. MDL-79185-401-4.png
          MDL-79185-401-4.png
          10 kB
        2. MDL-79185-401-8.png
          MDL-79185-401-8.png
          132 kB
        3. MDL-79185-402-4.png
          MDL-79185-402-4.png
          10 kB
        4. MDL-79185-402-8.png
          MDL-79185-402-8.png
          131 kB
        5. MDL-79185-403-4.png
          MDL-79185-403-4.png
          11 kB
        6. MDL-79185-403-8.png
          MDL-79185-403-8.png
          160 kB
        7. MDL-79185-main-4.png
          MDL-79185-main-4.png
          13 kB
        8. MDL-79185-main-8.png
          MDL-79185-main-8.png
          155 kB

            dmitriim Dmitrii Metelkin
            dmitriim Dmitrii Metelkin
            Brendan Heywood Brendan Heywood
            Ilya Tregubov Ilya Tregubov
            Kevin Percy Kevin Percy
            Votes:
            3 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 25 minutes
                4h 25m

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