Redis not gracefully not shutting down causing critical error.
-
Hi,
We are running a high-traffic site with Redis configured in Docker on a Plesk server and are encountering a critical issue when our server reboots or Redis restarts. Normally, Redis works fine for days, but when Redis becomes unavailable, our site immediately throws a critical error. Our hosting provider has confirmed that all usual configurations (memory overcommit, eviction policies, etc.) are correctly set, and they directed us to contact you for support.
When Redis goes down, we see the following critical error in our logs:
PHP Fatal error: Uncaught Error: Call to a member function get() on null in /var/www/vhosts/mysite.com/httpdocs/wp-content/object-cache.php:193.
If we delete the
object-cache.php
file, the site does not go into critical error mode, which indicates the issue is related to how the plugin handles Redis connection failures. We tried several fixes, including modifying theshow_error_and_die
method as suggested in a previous support thread, but these changes help to remove the uncaught error but site still goes down with when redis stops.We need a solution that ensures the site continues to run smoothly even if Redis is unavailable. This has become a critical issue as the downtime is causing massive disruptions and negatively affecting our business reputation.
Here are some specifics about our environment:
- Plesk server with Redis configured as per guidelines.
- Redis connection settings in
wp-config.php
:define('WP_REDIS_HOST', '127.0.0.1'); define('WP_REDIS_PORT', 6379'); define('WP_REDIS_DATABASE', 0); define('WP_CACHE_KEY_SALT', 'mysite.com:');
- When Redis is stopped, the site goes into a critical error state with the following log entries:vbnetCopy code
PHP Fatal error: Uncaught Error: Call to a member function get() on null in /var/www/vhosts/mysite.com/httpdocs/wp-content/object-cache.php:193
We need a fix that gracefully handles Redis connection failures, allowing the site to continue running without Redis until it becomes available again. Any assistance or guidance you can provide to resolve this issue would be greatly appreciated.
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.