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
439 stars 150 forks source link

"The command 'INFO' is not allowed in replication mode." after upgrade to 2.53 #540

Closed barsch closed 3 months ago

barsch commented 3 months ago

Upgrading Redis Object Cache from 2.5.2 to 2.53 disables our Wordpress multisite setup with the following error message:

Screenshot 2024-07-21 at 16-16-25 WordPress › Error

Trying to running any wp redis xxx command on command line results into the following traceback:

 $ wp redis status
Predis\NotSupportedException: The command 'INFO' is not allowed in replication mode. in /home/wordpress/www/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Replication/ReplicationStrategy.php:51
Stack trace:
#0 /home/wordpress/www/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Replication/SentinelReplication.php(546): Predis\Replication\ReplicationStrategy->isReadOperation()
#1 /home/wordpress/www/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Replication/SentinelReplication.php(580): Predis\Connection\Replication\SentinelReplication->getConnectionInternal()
#2 /home/wordpress/www/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Replication/SentinelReplication.php(712): Predis\Connection\Replication\SentinelReplication->getConnectionByCommand()
#3 /home/wordpress/www/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Replication/SentinelReplication.php(752): Predis\Connection\Replication\SentinelReplication->retryCommandOnFailure()
#4 /home/wordpress/www/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(349): Predis\Connection\Replication\SentinelReplication->executeCommand()
#5 /home/wordpress/www/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(303): Predis\Client->executeCommand()
#6 /home/wordpress/www/wp-content/object-cache.php(1153): Predis\Client->__call()
#7 /home/wordpress/www/wp-content/object-cache.php(562): WP_Object_Cache->fetch_info()
#8 /home/wordpress/www/wp-content/object-cache.php(256): WP_Object_Cache->__construct()
#9 /home/wordpress/www/wp-includes/load.php(870): wp_cache_init()
#10 /home/wordpress/www/wp-settings.php(145): wp_start_object_cache()
#11 phar:///home/wordpress/bin/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1374): require('...')
#12 phar:///home/wordpress/bin/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1293): WP_CLI\Runner->load_wordpress()
#13 phar:///home/wordpress/bin/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#14 phar:///home/wordpress/bin/wp-cli.phar/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process()
#15 phar:///home/wordpress/bin/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#16 phar:///home/wordpress/bin/wp-cli.phar/php/boot-phar.php(20): include('...')
#17 /home/wordpress/bin/wp-cli.phar(4): include('...')
#18 {main}
Error: Error establishing a Redis connection. To disable Redis, delete the `object-cache.php` file in the `/wp-content/` directory.

Deleting object-cache.php temporarily mitigates the issue by disabling Redis Object Cache plugin. Enabling it in admin results into the same error again.

Reverting to version 2.5.2 via

$ wp plugin install redis-cache --version=2.5.2 --force

results into a working Redis object cache again.

Expected Behavior

Version 2.5.3 should work as 2.5.2

Environment

$ wp core version
6.6

Taken from the working version 2.5.2

$ wp redis status
Status: Connected
Client: Predis (v2.1.2)
Drop-in: Valid
Disabled: No
Ping: PONG
Errors: []
PhpRedis: 5.3.7
Relay: Not loaded
Predis: 2.1.2
Credis: Not loaded
PHP Version: 8.2.20
Plugin Version: 2.5.2
Redis Version: Unknown
Multisite: Yes
Metrics: Enabled
Metrics recorded: 4
Filesystem: Writable
Global Prefix: ""
Blog Prefix: 1
Timeout: 1
Read Timeout: 1
Retry Interval: 
WP_REDIS_CLIENT: "predis"
WP_REDIS_DATABASE: 2
WP_REDIS_SERVERS: [
    "tcp://10.0.20.1:26379",
    "tcp://10.0.20.2:26379",
    "tcp://10.0.20.3:26379"
]
WP_REDIS_SENTINEL: "••••••••"
WP_REDIS_PREFIX: "••••••••"
WP_CACHE_KEY_SALT: "••••••••"
WP_REDIS_PLUGIN_PATH: "/home/wordpress/www/wp-content/plugins/redis-cache"
WP_REDIS_PASSWORD: ••••••••
Global Groups: [
    "blog-details",
    "blog-id-cache",
    "blog-lookup",
    "global-posts",
    "networks",
    "rss",
    "sites",
    "site-details",
    "site-lookup",
    "site-options",
    "site-transient",
    "users",
    "useremail",
    "userlogins",
    "usermeta",
    "user_meta",
    "userslugs",
    "redis-cache",
    "blog_meta",
    "network-queries",
    "site-queries",
    "theme_files",
    "translation_files",
    "user-queries",
    "titan_network_options"
]
Ignored Groups: [
    "counts",
    "plugins",
    "theme_json",
    "themes"
]
Unflushable Groups: []
Groups Types: {
    "blog-details": "global",
    "blog-id-cache": "global",
    "blog-lookup": "global",
    "global-posts": "global",
    "networks": "global",
    "rss": "global",
    "sites": "global",
    "site-details": "global",
    "site-lookup": "global",
    "site-options": "global",
    "site-transient": "global",
    "users": "global",
    "useremail": "global",
    "userlogins": "global",
    "usermeta": "global",
    "user_meta": "global",
    "userslugs": "global",
    "redis-cache": "global",
    "blog_meta": "global",
    "network-queries": "global",
    "site-queries": "global",
    "theme_files": "global",
    "translation_files": "global",
    "user-queries": "global",
    "counts": "ignored",
    "plugins": "ignored",
    "theme_json": "ignored",
    "titan_network_options": "global",
    "themes": "ignored"
}
Drop-ins: [
    "Redis Object Cache Drop-In v2.5.2 by Till Krüss",
    "sunrise.php v by "
]
troychaplin commented 3 months ago

We are having similar issues when we upgrade to 2.5.3

mcorkum commented 3 months ago

Same issues here after upgrading 2.5.2 to 2.5.3 - using sentinel.