• Resolved no7076

    (@no7076)


    Hello,

    We are trying to set up Redis Object Cache on a website, but facing problems whenever clicking “Enable Object Cache” button. Whenever enabled, we receive the “There has been a critical error on your website” page. Removing the /public_html/wp-content/object-cache.php file fixes the issue, as expected.

    WP debug.log:

    [16-Apr-2024 09:20:04 UTC] RedisException: Connection refused in /home/webselo/public_html/wp-content/object-cache.php:728
    Stack trace:
    #0 /home/webselo/public_html/wp-content/object-cache.php(728): Redis->connect()
    #1 /home/webselo/public_html/wp-content/object-cache.php(536): WP_Object_Cache->connect_using_phpredis()
    #2 /home/webselo/public_html/wp-content/object-cache.php(256): WP_Object_Cache->__construct()
    #3 /home/webselo/public_html/wp-includes/load.php(860): wp_cache_init()
    #4 /home/webselo/public_html/wp-settings.php(144): wp_start_object_cache()
    #5 /home/webselo/public_html/wp-config.php(133): require_once('/home/webselo/p...')
    #6 /home/webselo/public_html/wp-load.php(50): require_once('/home/webselo/p...')
    #7 /home/webselo/public_html/wp-blog-header.php(13): require_once('/home/webselo/p...')
    #8 /home/webselo/public_html/index.php(17): require('/home/webselo/p...')
    #9 {main}
    [16-Apr-2024 09:20:04 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /home/webselo/public_html/wp-content/object-cache.php:193
    Stack trace:
    #0 /home/webselo/public_html/wp-includes/class-wp-textdomain-registry.php(187): wp_cache_get()
    #1 /home/webselo/public_html/wp-includes/class-wp-textdomain-registry.php(302): WP_Textdomain_Registry->get_language_files_from_path()
    #2 /home/webselo/public_html/wp-includes/class-wp-textdomain-registry.php(98): WP_Textdomain_Registry->get_path_from_lang_dir()
    #3 /home/webselo/public_html/wp-includes/l10n.php(1354): WP_Textdomain_Registry->get()
    #4 /home/webselo/public_html/wp-includes/l10n.php(1384): _load_textdomain_just_in_time()
    #5 /home/webselo/public_html/wp-includes/l10n.php(194): get_translations_for_domain()
    #6 /home/webselo/public_html/wp-includes/l10n.php(306): translate()
    #7 /home/webselo/public_html/wp-content/object-cache.php(2922): __()
    #8 /home/webselo/public_html/wp-content/object-cache.php(2890): WP_Object_Cache->show_error_and_die()
    #9 /home/webselo/public_html/wp-content/object-cache.php(566): WP_Object_Cache->handle_exception()
    #10 /home/webselo/public_html/wp-content/object-cache.php(256): WP_Object_Cache->__construct()
    #11 /home/webselo/public_html/wp-includes/load.php(860): wp_cache_init()
    #12 /home/webselo/public_html/wp-settings.php(144): wp_start_object_cache()
    #13 /home/webselo/public_html/wp-config.php(133): require_once('/home/webselo/p...')
    #14 /home/webselo/public_html/wp-load.php(50): require_once('/home/webselo/p...')
    #15 /home/webselo/public_html/wp-blog-header.php(13): require_once('/home/webselo/p...')
    #16 /home/webselo/public_html/index.php(17): require('/home/webselo/p...')
    #17 {main}
      thrown in /home/webselo/public_html/wp-content/object-cache.php on line 193
    [16-Apr-2024 09:20:04 UTC] RedisException: Connection refused in /home/webselo/public_html/wp-content/object-cache.php:728
    Stack trace:
    #0 /home/webselo/public_html/wp-content/object-cache.php(728): Redis->connect()
    #1 /home/webselo/public_html/wp-content/object-cache.php(536): WP_Object_Cache->connect_using_phpredis()
    #2 /home/webselo/public_html/wp-content/object-cache.php(256): WP_Object_Cache->__construct()
    #3 /home/webselo/public_html/wp-includes/load.php(860): wp_cache_init()
    #4 /home/webselo/public_html/wp-settings.php(144): wp_start_object_cache()
    #5 /home/webselo/public_html/wp-config.php(133): require_once('/home/webselo/p...')
    #6 /home/webselo/public_html/wp-load.php(50): require_once('/home/webselo/p...')
    #7 /home/webselo/public_html/wp-blog-header.php(13): require_once('/home/webselo/p...')
    #8 /home/webselo/public_html/index.php(17): require('/home/webselo/p...')
    #9 {main}
    [16-Apr-2024 09:20:04 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /home/webselo/public_html/wp-content/object-cache.php:193
    Stack trace:
    #0 /home/webselo/public_html/wp-includes/class-wp-textdomain-registry.php(187): wp_cache_get()
    #1 /home/webselo/public_html/wp-includes/class-wp-textdomain-registry.php(302): WP_Textdomain_Registry->get_language_files_from_path()
    #2 /home/webselo/public_html/wp-includes/class-wp-textdomain-registry.php(98): WP_Textdomain_Registry->get_path_from_lang_dir()
    #3 /home/webselo/public_html/wp-includes/l10n.php(1354): WP_Textdomain_Registry->get()
    #4 /home/webselo/public_html/wp-includes/l10n.php(1384): _load_textdomain_just_in_time()
    #5 /home/webselo/public_html/wp-includes/l10n.php(194): get_translations_for_domain()
    #6 /home/webselo/public_html/wp-includes/l10n.php(306): translate()
    #7 /home/webselo/public_html/wp-content/object-cache.php(2922): __()
    #8 /home/webselo/public_html/wp-content/object-cache.php(2890): WP_Object_Cache->show_error_and_die()
    #9 /home/webselo/public_html/wp-content/object-cache.php(566): WP_Object_Cache->handle_exception()
    #10 /home/webselo/public_html/wp-content/object-cache.php(256): WP_Object_Cache->__construct()
    #11 /home/webselo/public_html/wp-includes/load.php(860): wp_cache_init()
    #12 /home/webselo/public_html/wp-settings.php(144): wp_start_object_cache()
    #13 /home/webselo/public_html/wp-config.php(133): require_once('/home/webselo/p...')
    #14 /home/webselo/public_html/wp-load.php(50): require_once('/home/webselo/p...')
    #15 /home/webselo/public_html/wp-blog-header.php(13): require_once('/home/webselo/p...')
    #16 /home/webselo/public_html/index.php(17): require('/home/webselo/p...')
    #17 {main}
      thrown in /home/webselo/public_html/wp-content/object-cache.php on line 193

    Plugin diagnostics:

    Status: Not enabled
    Client: 
    Drop-in: Not installed
    Disabled: No
    PhpRedis: 5.3.7
    Relay: Not loaded
    Predis: 2.1.2
    Credis: Not loaded
    PHP Version: 8.2.13
    Plugin Version: 2.5.1
    Redis Version: Unknown
    Multisite: No
    Metrics: Disabled
    Metrics recorded: 0
    Filesystem: Writable
    WP_REDIS_SCHEME: "unix"
    WP_REDIS_PATH: "/home/webselo/redis/redis.sock"
    WP_REDIS_DATABASE: "1"
    WP_REDIS_PLUGIN_PATH: "/home/webselo/public_html/wp-content/plugins/redis-cache"
    Drop-ins: [
        "advanced-cache.php v by "
    ]

    Redis logs from the same time period (hh:20):

    5241:M 16 Apr 12:19:02.036 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:07.165 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:12.185 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:17.194 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:22.203 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:27.275 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:32.399 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:37.574 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:42.624 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:43.290 - Accepted connection to /home/webselo/redis/redis.sock
    5241:M 16 Apr 12:19:43.291 - Client closed connection
    5241:M 16 Apr 12:19:47.647 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:52.659 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:57.676 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:19:58.114 - Accepted connection to /home/webselo/redis/redis.sock
    5241:M 16 Apr 12:19:58.120 - Client closed connection
    5241:M 16 Apr 12:20:02.753 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:07.856 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:12.949 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:13.847 - Accepted connection to /home/webselo/redis/redis.sock
    5241:M 16 Apr 12:20:13.849 - Client closed connection
    5241:M 16 Apr 12:20:17.959 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:22.976 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:28.031 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:33.081 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:38.151 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:43.172 - 1 clients connected (0 slaves), 468464 bytes in use
    5241:M 16 Apr 12:20:48.184 - 1 clients connected (0 slaves), 468464 bytes in use
    

    The “1 clients connected” is due to local redis-cli session, otherwise it would be 0.

    What we’ve already tried:

    • FLUSHALL
    • Use WP_REDIS_DATABASE default’s “0”

    We also have WP-Rocket plugin installed. Also a bunch of other times for websites on other hosts we’ve used the same Redis setup with unix socket file and Redis Object Cache plugin without a problem.

    We would be grateful if anyone helps us resolve this issue.

    • This topic was modified 7 months, 1 week ago by no7076. Reason: Add more information
Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Thanks for the extensive information.

    After removing object-cache.php what does Settings -> Redis show you?

    Thread Starter no7076

    (@no7076)

    Status: Not enabled
    Filesystem: Writeable
    Redis: Reachable

    This is shown, if that is what you referred to.

    Thread Starter no7076

    (@no7076)

    We also tried with a traditional 127.0.0.1:6379 setup but the same problem is still observed.

    Plugin Author Till Krüss

    (@tillkruess)

    Okay, Redis: Reachable is great. If you see this, try clicking on “Enable Object Cache” and see what happens and report back.

    If that crashes anything again, manually delete the wp-content/object-cache.php file.

    Thread Starter no7076

    (@no7076)

    Hello,

    Redis has always been Reachable in our tests. Enabling Object Cache still provides the same errors as stated in the original post.

    Plugin Author Till Krüss

    (@tillkruess)

    The original post contain multiple errors.

    RedisException: Connection refused 

    and

    Call to a member function get() on null

    Are both still occurring when you re-enable the cache, or just one?

    Thread Starter no7076

    (@no7076)

    Both occur and always alternate. For the period of ~10 seconds the plugin is “Enabled” and before I delete the file wp-content/object-cache.php , I can see these both errors in the debug.log 5-6 times each, alternating. The first one is

    RedisException: Connection refused 

    and the second is

    Call to a member function get() on null

    The errors are with the same stack traces as in the original post.

    Plugin Author Till Krüss

    (@tillkruess)

    We just released a fix for Call to a member function get() on null yesterday in v2.5.2.

    As for RedisException: Connection refused that sounds like your Redis Server doesn’t have enough resources available, or the timeouts need to be a bit higher.

    Try setting: WP_REDIS_TIMEOUT and WP_REDIS_READ_TIMEOUT to 3 seconds.

    Thread Starter no7076

    (@no7076)

    Hello,

    Unfortunately, even with the updated plugin and updated WP_REDIS_TIMEOUT and WP_REDIS_READ_TIMEOUT to 3 seconds, the same problem is still occurring. The redis server is not used by any other clients. We are currently out of ideas.

    Plugin Author Till Krüss

    (@tillkruess)

    You are still seeing both error, or just the Connection refused?

    Seeing the same error, plugin version 2.5.2, core version 6.5.2. We have several instances running these versions, but the error only occurs on one of them. It seems this is triggered by the error reporting function, so there is some underlying error here which kills the server when being translated:

    [26-Apr-2024 07:21:11 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /www/wp/wp-content/object-cache.php:193
    Stack trace:
    #0 /www/wp/wp-includes/class-wp-textdomain-registry.php(187): wp_cache_get()
    #1 /www/wp/wp-includes/class-wp-textdomain-registry.php(302): WP_Textdomain_Registry->get_language_files_from_path()
    #2 /www/wp/wp-includes/class-wp-textdomain-registry.php(98): WP_Textdomain_Registry->get_path_from_lang_dir()
    #3 /www/wp/wp-includes/l10n.php(1354): WP_Textdomain_Registry->get()
    #4 /www/wp/wp-includes/l10n.php(1384): _load_textdomain_just_in_time()
    #5 /www/wp/wp-includes/l10n.php(194): get_translations_for_domain()
    #6 /www/wp/wp-includes/l10n.php(306): translate()
    #7 /www/wp/wp-content/object-cache.php(2974): __()
    #8 /www/wp/wp-content/object-cache.php(2940): WP_Object_Cache->show_error_and_die()
    #9 /www/wp/wp-content/object-cache.php(566): WP_Object_Cache->handle_exception()
    #10 /www/wp/wp-content/object-cache.php(256): WP_Object_Cache->__construct()
    #11 /www/wp/wp-includes/load.php(860): wp_cache_init()
    #12 /www/wp/wp-settings.php(144): wp_start_object_cache()
    #13 /www/wp/wp-config.php(66): require_once('...')
    #14 /www/wp/wp-load.php(50): require_once('...')
    #15 /www/wp/wp-blog-header.php(13): require_once('...')
    #16 /www/wp/index.php(17): require('...')
    #17 {main}
      thrown in /www/wp/wp-content/object-cache.php on line 193

    So it seems when there is an error in wp_cache_init the error reporting function should not try to translate errors (or do so avoiding the cache).

    … of course, after editing the show-error-and-die method to not translate strings, I can no longer replicate the original error; so that was probably some issue or other with the server.

    Hello,
    I also have the “get()” error with 2.5.2 but there’s just before it a Redis Misconfiguration to save RDB snapshot…


    [30-Apr-2024 07:48:32 UTC] RedisException: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error. in /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php:559
    Stack trace:
    #0 /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php(559): Redis->ping()
    #1 /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php(256): WP_Object_Cache->__construct()
    #2 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/load.php(860): wp_cache_init()
    #3 /home/sc1sese9006/public_html/thivinfo.com/wp-settings.php(144): wp_start_object_cache()
    #4 /home/sc1sese9006/public_html/thivinfo.com/wp-config.php(79): require_once('/home/sc1sese90...')
    #5 /home/sc1sese9006/public_html/thivinfo.com/wp-load.php(50): require_once('/home/sc1sese90...')
    #6 /home/sc1sese9006/public_html/thivinfo.com/wp-admin/admin.php(34): require_once('/home/sc1sese90...')
    #7 /home/sc1sese9006/public_html/thivinfo.com/wp-admin/options-general.php(10): require_once('/home/sc1sese90...')
    #8 {main}
    [30-Apr-2024 07:48:32 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php:193
    Stack trace:
    #0 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/class-wp-textdomain-registry.php(187): wp_cache_get()
    #1 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/class-wp-textdomain-registry.php(302): WP_Textdomain_Registry->get_language_files_from_path()
    #2 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/class-wp-textdomain-registry.php(98): WP_Textdomain_Registry->get_path_from_lang_dir()
    #3 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/l10n.php(1354): WP_Textdomain_Registry->get()
    #4 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/l10n.php(1384): _load_textdomain_just_in_time()
    #5 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/l10n.php(194): get_translations_for_domain()
    #6 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/l10n.php(306): translate()
    #7 /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php(2974): __()
    #8 /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php(2940): WP_Object_Cache->show_error_and_die()
    #9 /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php(566): WP_Object_Cache->handle_exception()
    #10 /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php(256): WP_Object_Cache->__construct()
    #11 /home/sc1sese9006/public_html/thivinfo.com/wp-includes/load.php(860): wp_cache_init()
    #12 /home/sc1sese9006/public_html/thivinfo.com/wp-settings.php(144): wp_start_object_cache()
    #13 /home/sc1sese9006/public_html/thivinfo.com/wp-config.php(79): require_once('/home/sc1sese90...')
    #14 /home/sc1sese9006/public_html/thivinfo.com/wp-load.php(50): require_once('/home/sc1sese90...')
    #15 /home/sc1sese9006/public_html/thivinfo.com/wp-admin/admin.php(34): require_once('/home/sc1sese90...')
    #16 /home/sc1sese9006/public_html/thivinfo.com/wp-admin/options-general.php(10): require_once('/home/sc1sese90...')
    #17 {main}
      thrown in /home/sc1sese9006/public_html/thivinfo.com/wp-content/object-cache.php on line 193

    Hope this will help to solve (WP-Rocket also activated here)

    I wonder if the issue may come from Litespeed. My webserver is running it, not Apache…

    –edit —
    I had to activate and configure Redis in the Cpanel of my host.
    It generate some constant and then redis cache plugin is working.

    Plugin Author Till Krüss

    (@tillkruess)

    @iverok: Was this an issue on your end?

    … of course, after editing the show-error-and-die method to not translate strings, I can no longer replicate the original error; so that was probably some issue or other with the server.

    Or do you still need help with this?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Uncaught Error: Call to a member function get() on null’ is closed to new replies.