• 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 4 replies - 16 through 19 (of 19 total)
  • @tillkruess There is still a bug in the error-reporting function of object-cache.php in show-error-and-die if the site language is other than english at least: It tries to translate the error message using the cache if an errror occurs when initializing the cache. This crashes the system with the “Call to a member function get() on null” message which also hides the original error.

    For this to happen there has to be an underlying error of some sort on which we’ve focused our attention. In our case this seems to have been a transient affair.

    Hello @iverok

    Does your host use Cpanel as panel host?
    On mine, I have fixed this issue by following redis instructions available in the Panel. There are some PHP constants to add with path and password for example.

    @iverok No, but we have full access to the system. The problem that occurred with Redis on our side is separate from the bug; which again is the “call to member function get() on NULL” error, which is caused by the plugin trying to translate the error when reporting the original issue, whatever this is – it can be anything happening when instantiating the $wp_object_cache global. In our case the error was transient.

    Plugin Author Till Krüss

    (@tillkruess)

    @iverok Please open a new support thread so we can look into this just on your case. Please ensure the object-cache.php version is the latest file as well.

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