Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp cache flush breaks when using redis cluster on 2.5.3 #543

Closed
Trisky opened this issue Aug 6, 2024 · 6 comments · Fixed by #544 or #553
Closed

wp cache flush breaks when using redis cluster on 2.5.3 #543

Trisky opened this issue Aug 6, 2024 · 6 comments · Fixed by #544 or #553
Assignees
Labels

Comments

@Trisky
Copy link

Trisky commented Aug 6, 2024

Description

wp cache flush breaks when using redis cluster on 2.5.3 and predis

Expected Behavior

cache cleared

Actual Behavior

Flush fails

wp cache flush
Predis\NotSupportedException: The command 'INFO' is not allowed in replication mode. in /var/html/www/vendor/predis/predis/src/Replication/ReplicationStrategy.php:51
Stack trace:
#0 /var/html/www/vendor/predis/predis/src/Connection/Replication/SentinelReplication.php(547): Predis\Replication\ReplicationStrategy->isReadOperation(Object(Predis\Command\Redis\INFO))
#1 /var/html/www/vendor/predis/predis/src/Connection/Replication/SentinelReplication.php(581): Predis\Connection\Replication\SentinelReplication->getConnectionInternal(Object(Predis\Command\Redis\INFO))
#2 /var/html/www/vendor/predis/predis/src/Connection/Replication/SentinelReplication.php(713): Predis\Connection\Replication\SentinelReplication->getConnectionByCommand(Object(Predis\Command\Redis\INFO))
#3 /var/html/www/vendor/predis/predis/src/Connection/Replication/SentinelReplication.php(753): Predis\Connection\Replication\SentinelReplication->retryCommandOnFailure(Object(Predis\Command\Redis\INFO), 'executeCommand')
#4 /var/html/www/vendor/predis/predis/src/Client.php(381): Predis\Connection\Replication\SentinelReplication->executeCommand(Object(Predis\Command\Redis\INFO))
#5 /var/html/www/vendor/predis/predis/src/Client.php(336): Predis\Client->executeCommand(Object(Predis\Command\Redis\INFO))
#6 /var/html/www/web/app/object-cache.php(1153): Predis\Client->__call('info', Array)
#7 /var/html/www/web/app/object-cache.php(562): WP_Object_Cache->fetch_info()
#8 /var/html/www/web/app/object-cache.php(256): WP_Object_Cache->__construct(true)
#9 /var/html/www/web/wp/wp-includes/load.php(860): wp_cache_init()
#10 /var/html/www/web/wp/wp-settings.php(144): wp_start_object_cache()
#11 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1374): require('/var/html/www/w...')
#12 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1293): WP_CLI\Runner->load_wordpress()
#13 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#14 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#15 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#16 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('phar:///usr/loc...')
#17 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#18 {main}
Error: The object cache could not be flushed.

Possible Fix

Steps to Reproduce

  1. Enable cluster with WP_REDIS_DISABLE_GROUP_FLUSH=true
  2. run wp cache flush
  3. error

Additional context

Problem is fixed as soon as I rollback to v2.5.2

Environment

  • Plugin version: 2.5.3
  • PHP version: 8.2
  • WordPress version: 6.5.5
@Trisky Trisky added the bug label Aug 6, 2024
@tillkruss
Copy link
Member

Can you try the develop branch which includes #541?

@erfan-ilyas
Copy link

erfan-ilyas commented Aug 7, 2024

image

Got the same issue.

Got these constants defined.

define( 'WP_REDIS_IGBINARY', true );
define( 'WP_REDIS_DISABLE_METRICS', true );
define( 'WP_REDIS_DISABLE_BANNERS', true );
define( 'WP_REDIS_DISABLE_ADMINBAR', true );
define( 'WP_REDIS_DISABLE_DROPIN_CHECK', true );
define( 'WP_REDIS_DISABLE_DROPIN_AUTOUPDATE', true );

define( 'WP_REDIS_CLIENT', 'predis' );
define( 'WP_REDIS_SENTINEL', 'mymaster' );
define( 'WP_REDIS_SERVERS', ['tcp://127.0.0.1:26379',] );

Was working fine on Version 2.5.0

I will try the version 2.5.2 as stated by @Trisky

@tillkruss
Copy link
Member

@erfan-ilyas I just merged #544, does that resolve it for you?

@dustinrue
Copy link

@tillkruss I am seeing that #544 seems to cause this:

Predis\ClientException: Command `GETMASTER` is not a registered Redis command. in /var/www/html/wordpress/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Command/Factory.php:67
Stack trace:
#0 /var/www/html/wordpress/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(313): Predis\Command\Factory->create()
#1 /var/www/html/wordpress/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(304): Predis\Client->createCommand()
#2 /var/www/html/wordpress/wp-content/object-cache.php(1151): Predis\Client->__call()
#3 /var/www/html/wordpress/wp-content/object-cache.php(562): WP_Object_Cache->fetch_info()

If I revert this change it appears to work fine and I do not get OPs original issue about the info command. I am using this configuration:

define( 'WP_REDIS_CLIENT', 'predis' );
define( 'WP_REDIS_SENTINEL', 'mymaster' );
define( 'WP_REDIS_SERVERS', ['tcp://redis:26379/?password=ZfY2jy4W7xwA3spcJhHRtQ'] );
define( 'WP_REDIS_PASSWORD', 'ZfY2jy4W7xwA3spcJhHRtQ' );
define( 'WP_REDIS_TIMEOUT', 1 );
define( 'WP_REDIS_READ_TIMEOUT', 1 );
define( 'WP_REDIS_DATABASE', 0 ); 

I am running Redis Sentinal in Kube using the bitnami/redis chart. I only need to spec a single sentinel because the Kube load balancer will always route me to a live sentinel which is replicated. I am running the develop branch as is with that commit backed out.

@tillkruss
Copy link
Member

@yatsukhnenko Can you take another look at this?

@neverlless
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment