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
427 stars 149 forks source link

Got Uncaught RedisException: No such file or directory after Upgrade to 2.3.0 #451

Closed ThomasTr closed 1 year ago

ThomasTr commented 1 year ago

Previous version 2.2.4 worked fine. After installing the new object-cache.php i got this error: Error: Fatal error: Uncaught RedisException: No such file or directory in /xxx/public/wordpress/wp-content/object-cache.php:726 Stacktrace:

Stack trace: 
#0 /xxx/public/wordpress/wp-content/object-cache.php(726): Redis->connect('/var/run/redis/...', -1, 1, '', 0, 1) 
#1 /xxx/public/wordpress/wp-content/object-cache.php(538): WP_Object_Cache->connect_using_phpredis(Array) 
#2 /xxx/public/wordpress/wp-content/object-cache.php(256): WP_Object_Cache->__construct(false) 
#3 /xxx/public/wordpress/wp-includes/load.php(750): wp_cache_init() 
#4 /xxx/public/wordpress/wp-settings.php(131): wp_start_object_cache() 
#5 /xxx/public/wordpress/wp-config.php(77): require_once('/Users/tom/Proj...') 
#6 /xxx/public/wordpress/wp-load.php(50): require_once('/Users/tom/Proj...') 
#7 /xxx/public/wordpress/wp-admin/admin.php(34): require_once('/Users/tom/Proj...') 
#8 /xxx/public/wordpress/wp-admin/options-general.php(10): require_once('/Users/tom/Proj...') 
#9 /Users/tom/.composer/vendor/laravel/valet/server.php(250): require('/Users/tom/Proj...') #10 {main} thrown in /xxx/public/wordpress/wp-content/object-cache.php on line 726

Using phpredis 5.3.4 with php 8.1.16

ThomasTr commented 1 year ago

I did a little more research: Redis was not connected on my dev machine where I tested the update, because WP_REDIS_PATH had the settings from the prod server.

Version 2.3.0 throws an error here. The previous version 2.2.4 does not throw an error and shows "not connected".

After I adjusted the setting for WP_REDIS_PATH on my DEV machine, and Redis was connected, I was also able to update to 2.3.0. this version now also runs without errors.

If this is the desired behaviour, we can also close this issue.

tillkruss commented 1 year ago

Yes, the socket configuration was very loose in 2.2.x and prior. Yesterdays release made it stricter to avoid accidental connections like yours.

From wp.org:

If you look at the changelog, yesterdays version 2.3.0 introduced a new change:

Throw errors when connection error occurs Made Predis unix socket connections stricter

Prior to v2.3.0 when Redis Object Cache could not connect to Redis it would sometimes silently fail or fallback to 127.0.0.1 even when WP_REDIS_PATH was configured to connect to a socket.

So in short, v2.3.0 is not broken, you Redis Server is and you need to check your configuration.