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

PHP Warning when purging all caches: race condition?

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5, 2.6.3, 2.7
    • 3.10
    • Caching
    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • MOODLE_310_STABLE
    • MDL-38350-master
    • Hide
      1. Check in /cache/admin.php that your Moodle system has the 'core coursemodinfo' cache configured to use a file store (not Redis or anything else). This is default, but it's possible you might have changed it.
      2. Also check in admin settings / Development / Debugging that debugging is set to 'Developer' level and is set to display in the output.
      3. Copy the attached purge-conflict.php file into the root directory of your Moodle testing system.
      4. Open 2 different web browsers. Either use 2 different browsers e.g. Firefox, Chrome or else use one 'normal' browser and one copy in private/incognito mode - the point is that you will need two different Moodle sessions at once.
      5. In the first browser (Browser A), go to a Moodle page and log in. Get ready to do 'purge all caches' quickly - either from the link at the bottom of the page (if enabled) or from the page in site admin under Development.
      6. In the second browser (Browser B), go to /purge-conflict.php - the page should load, displaying a link to 'Go!'
      7. Click the link to 'Go!' in browser B. Wait until it starts displaying dots.
      8. Quickly purge all caches in browser A. You need to have started, and ideally finished, the purge caches process before browser B finishes displaying dots.
      9. Check the purge caches (Browser A) complete without errors (so no 'Directory not empty' errors are displayed).
        • Note: You may still see an error 'failed to open stream: No such file or directory' in browser B. This is probably OK, I got the same error before and after this change.
      Show
      Check in /cache/admin.php that your Moodle system has the 'core coursemodinfo' cache configured to use a file store (not Redis or anything else). This is default, but it's possible you might have changed it. Also check in admin settings / Development / Debugging that debugging is set to 'Developer' level and is set to display in the output. Copy the attached purge-conflict.php file into the root directory of your Moodle testing system. Open 2 different web browsers. Either use 2 different browsers e.g. Firefox, Chrome or else use one 'normal' browser and one copy in private/incognito mode - the point is that you will need two different Moodle sessions at once. In the first browser (Browser A), go to a Moodle page and log in. Get ready to do 'purge all caches' quickly - either from the link at the bottom of the page (if enabled) or from the page in site admin under Development. In the second browser (Browser B), go to /purge-conflict.php - the page should load, displaying a link to 'Go!' Click the link to 'Go!' in browser B. Wait until it starts displaying dots. Quickly purge all caches in browser A. You need to have started, and ideally finished, the purge caches process before browser B finishes displaying dots. Check the purge caches (Browser A) complete without errors (so no 'Directory not empty' errors are displayed). Note: You may still see an error 'failed to open stream: No such file or directory' in browser B. This is probably OK, I got the same error before and after this change.

    Description

      Never hit before now, I was using 3 tabs each with a Moodle page using them quite at the same time and one of them used to trigger the Purge all caches (http://localhost/moodle-master/admin/purgecaches.php) action.

      PHP Warning:  rmdir(/path/to/moodle-master-data/cache/cachestore_file/default_application) [<a href='function.rmdir'>function.rmdir</a>]: Directory not empty in /path/to/moodle-master/lib/moodlelib.php on line 10750
      

      Attachments

        1. purge_all_caches.png
          147 kB
        2. purge-conflict.php
          2 kB
        3. purge-conflict.png
          120 kB
        4. test.php
          0.8 kB

        Issue Links

          Activity

            People

              quen Sam Marshall
              matteo Matteo Scaramuccia
              Tim Hunt Tim Hunt
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              sumit negi sumit negi (Inactive)
              Matteo Scaramuccia, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              8 Vote for this issue
              Watchers:
              25 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Nov/20

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours
                  6h