rhubarbgroup / redis-cache

A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
https://wordpress.org/plugins/redis-cache/
GNU General Public License v3.0
425 stars 148 forks source link

Error when saving in editor #534

Closed troychaplin closed 2 months ago

troychaplin commented 3 months ago

Description

I am getting the following error in my server logs when I save any page. I am using WP 6.5.3 in a Gutenberg environment.

PHP Fatal error: Uncaught Error: Call to undefined method Predis\\Connection\\Replication\\SentinelReplication::getParameters() in /server_path/wp-content/object-cache.php:1651
Stack trace:
#0 /server_path/wp-content/object-cache.php(1830): WP_Object_Cache->execute_lua_script()
#1 /server_path/wp-content/object-cache.php(171): WP_Object_Cache->flush_group()
#2 /server_path/wp-content/plugins/wordpress-seo/src/builders/indexable-link-builder.php(710): wp_cache_flush_group()
#3 /server_path/wp-content/plugins/wordpress-seo/src/builders/indexable-link-builder.php(623): Yoast\\WP\\SEO\\Builders\\Indexable_Link_Builder->update_incoming_links_for_related_indexables()
#4 /server_path/wp-content/plugins/wordpress-seo/src/builders/indexable-link-builder.php(136): Yoast\\WP\\SEO\\Builders\\Indexable_Link_Builder->update_related_indexables()\n#5 /server_path/wp-content/plugins/wordpress-seo/src/integrat...

I am using Redis Sentinel for caching via predis. I am running PHP 8.0.30. I am using version 2.5.2 of Redis Object Cache. I am using Yoast SEO version 22.8. I can flush the cache using the admin toolbar or wp-cli.

Expected Behavior

The post to save without error

Actual Behavior

Every second attempt at updating I get an error at the top of the editor that says Updating failed. The response is not a value JSON response.

Possible Fix

Maybe related to the discussion happening in GH-528

Steps to Reproduce

  1. Have both plugins mentioned in description active
  2. Edit a page, update. Update again. Error message typically happens every second update. PHP log error displayed with each update attempt.

Additional context

Unable to turn cache on in our production environment

Environment

tillkruss commented 2 months ago

@yatsukhnenko Can you try running a group_flush() using Redis Sentinel when using Predis as the client. We may have missed that when we refactored it in 2.5.0.

tillkruss commented 2 months ago

See #522.

tillkruss commented 2 months ago

@troychaplin #522 should have fixed this 👍