[wp-trac] [WordPress Trac] #40052: Issue with WP_Cache not invalidating stale cache after an update request
WordPress Trac
noreply at wordpress.org
Mon Mar 6 22:40:51 UTC 2017
#40052: Issue with WP_Cache not invalidating stale cache after an update request
-----------------------------------------+-----------------------------
Reporter: cookiesowns | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache API | Version: 4.7.3
Severity: normal | Keywords:
Focuses: administration, performance |
-----------------------------------------+-----------------------------
Hi,
There appears to be an issue with WP_Cache if/when an object-cache has a
stale value, and you attempt to update that value to the value that
already exists in the database ( race condition as an example ). The
object-cache in this case will never be invalidated until the TTL is hit,
or if/when the cache is flushed.
This affects high volume sites that has repetitive actions.
An example of this happens on our site in production on user_meta, where
quick endpoints fire that requires a set value on user_meta, however
occasionally redis-cache will not get updated with the new value, even
though the wp database does have the proper value.
In this case there's an infinite loop where wp_cache will return the old
stale value, and the code will correctly attempt to update it to the new
value, but WP thinks the value is already correct, and thus the object-
cache will not be updated.
Potentially related bugs are #26779 & #31245
An easy solution is to add a wp_cache_delete onto lines 195/196 here:
https://github.com/WordPress/WordPress/blob/master/wp-
includes/meta.php#L190-L253
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40052>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list