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

Stacked coursemodinfo cache broken due to requirelockingbeforewrite

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.1
    • 4.1
    • Caching
    • MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • MDL-76076_master
    • Hide

      Set coursemodinfo cache to use a single store.

      Show
      Set coursemodinfo cache to use a single store.
    • Hide

      Also covered by unit tests cache_test::test_application_locking_multiple_layers

      • As admin visit Site administration > Caching > Configuration
      • Click "Add instance" link in the "File Cache" to add a new instance.
      • Set the store name to "Local" and set the path to somewhere writable (e.g. /tmp/filecache). Tick "Auto create directory" checkbox and click "Save changes").
      • Under "Known cache definitions" section find "Accumulated information about modules and sections for each course" (coursemodinfo) and click "Edit mappings"
      • Set "Primary store" to "Local", "Final store" to "default_application", and click "Save changes"
      • Visit a course page
      • Visit the settings page and save changes
      • You should not see any error messages.
      Show
      Also covered by unit tests cache_test::test_application_locking_multiple_layers As admin visit Site administration > Caching > Configuration Click "Add instance" link in the "File Cache" to add a new instance. Set the store name to "Local" and set the path to somewhere writable (e.g. /tmp/filecache). Tick "Auto create directory"  checkbox and click "Save changes" ). Under "Known cache definitions" section find "Accumulated information about modules and sections for each course" (coursemodinfo) and click "Edit mappings" Set "Primary store" to "Local", "Final store" to "default_application", and click "Save changes" Visit a course page Visit the settings page and save changes You should not see any error messages.

    Description

      Steps to reproduce:

      • On latest master
      • Visit /cache/admin.php and add a new FIle Cache instance.
      • Set the store name to "Local" and set the path to somewhere writable (e.g. /tmp/filecache). Tick "Auto create directory" and click "Save changes").
      • Under "Known cache definitions" find "Accumulated information about modules and sections for each course" (coursemodinfo) and click "Edit mappings"
      • Set "Primary store" to "Local", "Final store" to "default_application", and click "Save changes"
      • You will see the error "Attempted to set cache key "1" without a lock. Locking before writes is required for core/coursemodinfo"

      This is due to the changes made in MDL-67020 not taking locking across multiple cache layers into account. A lock is not being created before attempting to set a key on a parent cache, or when reading a value from a parent cache and storing it in the child cache.

      Attachments

        Issue Links

          Activity

            People

              marxjohnson Mark Johnson
              marxjohnson Mark Johnson
              Brendan Heywood Brendan Heywood
              Andrew Lyons Andrew Lyons
              Simey Lameze Simey Lameze
              Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                28/Nov/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 48 minutes
                  1h 48m