Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a followup for https://www.drupal.org/project/memcache/issues/2993368 while MemCacheDrupal::get() works now, MemCacheDrupal::getMultiple() still makes old invalid data valid again.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3055155-multiget-stampede.patch | 529 bytes | marco |
Comments
Comment #2
marco CreditAttribution: marco at Tag1 Consulting commentedThe reason is that valid(), in case of stampede, changes $cache, but the $results array in getMultiple() is not updated.
Note that cache_get_multiple() is called way more than cache_get().
In our case, this resulted in cache_get_multiple() returning NULL as the cached item, and this was very visible during load testing. I believe what happened was:
- dmemcache_get_multi() returned NULL simply because the item did not exist
- valid() kicks stampede protection and gets the correct value, but does not end up updating the value in getMultiple()
- valid() has a valid value, so it returns true
- getMultiple() returns the original value, NULL
Comment #3
marco CreditAttribution: marco at Tag1 Consulting commentedComment #4
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedRTBC - Great catch!
Comment #6
Jeremy CreditAttribution: Jeremy at Tag1 Consulting commentedThanks for the patch Marco, and for testing Fabian! Patch committed, and will be part of the next release.
Comment #8
ndobromirov CreditAttribution: ndobromirov at FFW commentedIs this affecting D8?