Support » Plugin: Redis Object Cache » Redis connection timeouts and unreachable error

  • Resolved timmepfeife

    (@timmepfeife)


    Hi, firstly, thanks for your plugin. I use it on multiple sites, and it worked great until the recent update. After upgrading to v2.4.1 we have the same issue as mentioned in the already resolved topic. We connect over TLS and ACL (username, password) to our Redis cloud instance. The status also says connected, but not reachable. But instead of the error mentioned in the linked post above, we get the “Redis is unreachable: SELECT failed: NOAUTH Authentication required.” error like mentioned in this post. This has several side effects, so I had to disable the object cache for now because we have high traffic in our shop:

    • Sometimes the users see a “Redis unavailable” error page, but after reloading it’s gone
    • Some WooCommerce orders are created twice in the same second, inclusive their payments
    • The product, order, payment sync with the JTL-Connector Plugin is blocked because of the issue mentioned first. This blocks syncing products, prices and inventories.

    Below my diagnosis after disabling the plugin (I blacked out some connection data):

    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: 7.4.33
    Plugin Version: 2.4.1
    Redis Version: Unknown
    Multisite: No
    Metrics: Disabled
    Metrics recorded: 0
    Filesystem: Working
    WP_REDIS_DISABLED: false
    WP_REDIS_SCHEME: "tls"
    WP_REDIS_SSL_CONTEXT: {
        "verify_peer": false,
        "verify_peer_name": false
    }
    WP_REDIS_HOST: "vultr-prod-vultr-prod-3165.vultrdb.com"
    WP_REDIS_PORT: 16752
    WP_REDIS_DATABASE: 0
    WP_REDIS_PREFIX: "my-prefix"
    WP_REDIS_PLUGIN_PATH: "/srv/www/thehoneyfactory.de/releases/20230514203445/web/app/plugins/redis-cache"
    WP_REDIS_PASSWORD: ["my-user","••••••••"]
    Drop-ins: [
        "advanced-cache.php v by "
    ]

    I can’t enable it right now, but the diagnosis was something like:

    Status: Connected
    Client: PhpRedis (v5.3.7)
    Drop-in: Valid
    Disabled: No
    Ping: 1
    Errors: []
    PhpRedis: 5.3.7
    Relay: Not loaded
    Predis: 2.1.2
    Credis: Not loaded
    PHP Version: 8.0.28
    Plugin Version: 2.4.1
    Redis Version: 7.0.10
    Multisite: No
    Metrics: Enabled
    Metrics recorded: 44
    Filesystem: Working
    WP_REDIS_DISABLED: false
    WP_REDIS_SCHEME: "tls"
    WP_REDIS_SSL_CONTEXT: {
        "verify_peer": false,
        "verify_peer_name": false
    }
    WP_REDIS_HOST: "vultr-prod-vultr-prod-3165.vultrdb.com"
    WP_REDIS_PORT: 16752
    WP_REDIS_DATABASE: 0
    WP_REDIS_PREFIX: "my-prefix"
    WP_REDIS_PLUGIN_PATH: "/srv/www/thehoneyfactory.de/releases/20230514203445/web/app/plugins/redis-cache"
    WP_REDIS_PASSWORD: ["my-user","••••••••"]
    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache",
        "blog_meta"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes",
        "theme_json"
    ]
    Unflushable Groups: []
    Groups Types: {
        "blog-details": "global",
        "blog-id-cache": "global",
        "blog-lookup": "global",
        "global-posts": "global",
        "networks": "global",
        "rss": "global",
        "sites": "global",
        "site-details": "global",
        "site-lookup": "global",
        "site-options": "global",
        "site-transient": "global",
        "users": "global",
        "useremail": "global",
        "userlogins": "global",
        "usermeta": "global",
        "user_meta": "global",
        "userslugs": "global",
        "redis-cache": "global",
        "counts": "ignored",
        "plugins": "ignored",
        "themes": "ignored",
        "blog_meta": "global",
        "theme_json": "ignored"
    }
    Drop-ins: [
        "advanced-cache.php v by "
        "Redis Object Cache Drop-In v2.4.1 by Till Krüss"
    ]

    Just wanted to let you know that something is not working, properly, with the latest version.

    • This topic was modified 2 weeks, 3 days ago by timmepfeife.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    “Redis is unreachable: SELECT failed: NOAUTH Authentication required.”

    Is this still happening? You may need to set WP_REDIS_CLIENT=phpredis to use a username to connect.

    Sometimes the users see a “Redis unavailable” error page, but after reloading it’s gone

    That means your Redis Server isn’t available and I’d suggest asking your host for assistance. Might be running out of CPU, or connections.

    Some WooCommerce orders are created twice in the same second, inclusive their payments

    This plugin is not the issue, it’s just providing WordPress with wp_cache_*() functions for persistent caching. I doubt it’s Woo itself, but probably Woo plugin.

    The product, order, payment sync with the JTL-Connector Plugin is blocked because of the issue mentioned first. This blocks syncing products, prices and inventories.

    Same as the Woo orders. Check the FAQ.

    Thread Starter timmepfeife

    (@timmepfeife)

    Thanks for your fast reply!

    Is this still happening? You may need to set WP_REDIS_CLIENT=phpredis to use a username to connect.

    I will try that out.

    That means your Redis Server isn’t available and I’d suggest asking your host for assistance. Might be running out of CPU, or connections.

    That’s definitely not the case. The Redis server is bored, we have 10 to 30% CPU usage on average.

    This plugin is not the issue, it’s just providing WordPress with wp_cache_*() functions for persistent caching. I doubt it’s Woo itself, but probably Woo plugin.

    The function is not the issue because it’s working fine for the last year. It’s the Redis timeout, which is happening randomly since upgrading to the latest version.

    I’m going to test the WP_REDIS_CLIENT=phpredis config. I’m actually quite positive that this will resolve the issues.

    Plugin Author Till Krüss

    (@tillkruess)

    You can also set custom read/write timeouts 👍

    Thread Starter timmepfeife

    (@timmepfeife)

    Thanks for the hint, I will try this out on our staging system. Sadly, setting WP_REDIS_CLIENT=phpredis didn’t change anything.

    Plugin Author Till Krüss

    (@tillkruess)

    What’s the error after setting WP_REDIS_CLIENT?

    Thread Starter timmepfeife

    (@timmepfeife)

    So, I wanted to try it out on our staging system, but there I got the following error. I can’t even access your status page. The only difference between staging and production is the PHP version right now. Staging is already running on php8, while production is still on 7.4.

    When seeking help with this issue, you may be asked for some of the following information:
    WordPress-Version 6.2
    Aktives Theme: WordPress Child Theme Atomion (Version 1.0)
    Aktuelles Plugin: Redis Object Cache (Version 2.4.1)
    PHP-Version 8.0.26
    
    Fehler-Details
    ==============
    Ein Fehler vom Typ E_ERROR wurde in der Zeile 167 der Datei /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php verursacht. Fehlermeldung: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php:167
    Stack trace:
    #0 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php(167): strlen(Array)
    #1 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php(100): Predis\Connection\Factory->prepareConnection(Object(Predis\Connection\StreamConnection))
    #2 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/dependencies/predis/predis/src/Client.php(127): Predis\Connection\Factory->create(Object(Predis\Connection\Parameters))
    #3 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/dependencies/predis/predis/src/Client.php(68): Predis\Client::createConnection(Object(Predis\Configuration\Options), Array)
    #4 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/includes/class-predis.php(119): Predis\Client->__construct(Array, Array)
    #5 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/includes/class-plugin.php(592): Rhubarb\RedisCache\Predis->connect()
    #6 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/includes/ui/tabs/overview.php(16): Rhubarb\RedisCache\Plugin->check_redis_connection()
    #7 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/includes/ui/class-tab.php(167): include('/srv/www/stagin...')
    #8 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/includes/ui/settings.php(59): Rhubarb\RedisCache\UI\Tab->display()
    #9 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/app/plugins/redis-cache/includes/class-plugin.php(202): require_once('/srv/www/stagin...')
    #10 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/wp/wp-includes/class-wp-hook.php(308): Rhubarb\RedisCache\Plugin->show_admin_page('')
    #11 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/wp/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
    #12 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #13 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/wp/wp-admin/admin.php(259): do_action('settings_page_r...')
    #14 /srv/www/staging.thehoneyfactory.de/releases/20230515070854/web/wp/wp-admin/options-general.php(10): require_once('/srv/www/stagin...')
    #15 {main}
    thrown

    Somehow, it still tries to use predis instead of phpredis. I’m going to enable it on production when we don’t have that much traffic, so I can send you the logs.

    Status: Not enabled
    Client: phpredis
    Drop-in: Not installed
    Disabled: No
    PhpRedis: 5.3.7
    Relay: Not loaded
    Predis: Not loaded
    Credis: Not loaded
    PHP Version: 8.0.26
    Plugin Version: 2.4.1
    Redis Version: Unknown
    Multisite: No
    Metrics: Disabled
    Metrics recorded: 0
    Filesystem: Working
    WP_REDIS_DISABLED: false
    WP_REDIS_CLIENT: "phpredis"
    WP_REDIS_SCHEME: "tls"
    WP_REDIS_SSL_CONTEXT: {
        "verify_peer": false,
        "verify_peer_name": false
    }
    WP_REDIS_HOST: "vultr-prod.vultrdb.com"
    WP_REDIS_PORT: 16752
    WP_REDIS_DATABASE: 1
    WP_REDIS_PREFIX: "suf_thehoneyfactory_stage"
    WP_REDIS_PLUGIN_PATH: "/srv/www/staging.thehoneyfactory.de/releases/20230520130646/web/app/plugins/redis-cache"
    WP_REDIS_PASSWORD: ["my-user","••••••••"]
    Drop-ins: [
        "advanced-cache.php v by "
    ]
    Plugin Author Till Krüss

    (@tillkruess)

    You have to use dev-main from GitHub, which has an unreleased fix when using username+password combinations. Or use PHP 8.0+.

    Thread Starter timmepfeife

    (@timmepfeife)

    Hi, I installed dev-main, but I still get the error: Redis is unreachable: SELECT failed: NOAUTH Authentication required. [tls://vultr-prod.vultrdb.com:16752]

    I keep it enabled and watch if we still have issues.

    Status: Verbunden
    Client: PhpRedis (v5.3.7)
    Drop-in: Valid
    Disabled: No
    Ping: 1
    Errors: []
    PhpRedis: 5.3.7
    Relay: Not loaded
    Predis: 2.1.2
    Credis: Not loaded
    PHP Version: 7.4.33
    Plugin Version: 2.4.1
    Redis Version: 7.0.11
    Multisite: No
    Metrics: Enabled
    Metrics recorded: 2001
    Filesystem: Working
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_DISABLED: false
    WP_REDIS_CLIENT: "phpredis"
    WP_REDIS_SCHEME: "tls"
    WP_REDIS_SSL_CONTEXT: {
        "verify_peer": false,
        "verify_peer_name": false
    }
    WP_REDIS_HOST: "vultr-prod-.vultrdb.com"
    WP_REDIS_PORT: 16752
    WP_REDIS_DATABASE: 0
    WP_REDIS_PREFIX: "thehoneyfactory_de_production"
    WP_REDIS_PLUGIN_PATH: "/srv/www/thehoneyfactory.de/releases/20230528124723/web/app/plugins/redis-cache"
    WP_REDIS_PASSWORD: ["my-user","••••••••"]
    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache",
        "blog_meta",
        "code_snippets",
        "woo_variation_swatches"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes",
        "theme_json",
        "wordfence",
        "wordfence-ls"
    ]
    Unflushable Groups: []
    Groups Types: {
        "blog-details": "global",
        "blog-id-cache": "global",
        "blog-lookup": "global",
        "global-posts": "global",
        "networks": "global",
        "rss": "global",
        "sites": "global",
        "site-details": "global",
        "site-lookup": "global",
        "site-options": "global",
        "site-transient": "global",
        "users": "global",
        "useremail": "global",
        "userlogins": "global",
        "usermeta": "global",
        "user_meta": "global",
        "userslugs": "global",
        "redis-cache": "global",
        "counts": "ignored",
        "plugins": "ignored",
        "themes": "ignored",
        "blog_meta": "global",
        "theme_json": "ignored",
        "code_snippets": "global",
        "wordfence": "ignored",
        "wordfence-ls": "ignored",
        "woo_variation_swatches": "global"
    }
    Drop-ins: [
        "advanced-cache.php v by ",
        "Redis Object Cache Drop-In v2.4.1 by Till Krüss"
    ]
    • This reply was modified 5 days, 13 hours ago by timmepfeife.
    Plugin Author Till Krüss

    (@tillkruess)

    Alright, so this was fixed in this commit.

    Can pull the latest dev-main and try using WP_REDIS_CLIENT=predis your current authentication?

    I’m asking because I wonder if there is a TLS+ACL issue somewhere.

    Thread Starter timmepfeife

    (@timmepfeife)

    I tried now with dev-main and WP_REDIS_CLIENT=predis but the whole deployment fails with the following error. When I use WP_REDIS_CLIENT=phpredis the deployment is working and only the UI shows Redis is unreachable: SELECT failed: NOAUTH Authentication required.

    TASK [deploy : WordPress Installed?] *******************************************System info:  Ansible 2.10.13; Darwin  Trellis 1.8.0: February 12th, 2021---------------------------------------------------non-zero return codeWarning: strlen() expects parameter 1 to be string, array given in/srv/www/thehoneyfactory.de/releases/20230529121803/web/app/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php on line 167Error: Error establishing a Redis connection. SELECTfailed: NOAUTHAuthentication required. [tls://vultr-prod-94868907-dd75-4b5b-9cac-646fa266172a-vultr-prod-3165.vultrdb.com:16752]fatal: [95.179.249.155]: FAILED! => {"changed": false, "cmd": ["wp", "core", "is-installed", "--skip-plugins", "--skip-themes", "--require=/srv/www/thehoneyfactory.de/shared/tmp_multisite_constants.php"], "delta": "0:00:00.252447", "end": "2023-05-29 12:18:38.519604", "failed_when_result": true, "rc": 1, "start": "2023-05-29 12:18:38.267157", "stderr_lines": ["Warning: strlen() expects parameter 1 to be string, array given in /srv/www/thehoneyfactory.de/releases/20230529121803/web/app/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php on line 167", "Error: Error establishing a Redis connection. SELECTfailed: NOAUTH Authentication required. [tls://vultr-prod-94868907-dd75-4b5b-9cac-646fa266172a-vultr-prod-3165.vultrdb.com:16752]"], "stdout": "", "stdout_lines": []}
    Plugin Author Till Krüss

    (@tillkruess)

    Are you using a “Managed Database” for Redis on Vultur?

    Can you try moving all WP_REDIS_* constants to the very top of your wp-config.php file just in case?

    Thread Starter timmepfeife

    (@timmepfeife)

    Somehow It didn’t post the results. When I remove the WP_REDIS_* constants, it connects to the local Redis instance.

    Status: Verbunden
    Client: PhpRedis (v5.3.7)
    Drop-in: Valid
    Disabled: No
    Ping: 1
    Errors: []
    PhpRedis: 5.3.7
    Relay: Not loaded
    Predis: 2.1.2
    Credis: Not loaded
    PHP Version: 7.4.33
    Plugin Version: 2.4.1
    Redis Version: 5.0.7
    Multisite: No
    Metrics: Enabled
    Metrics recorded: 1728
    Filesystem: Working
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_PLUGIN_PATH: "/srv/www/thehoneyfactory.de/releases/20230530192030/web/app/plugins/redis-cache"
    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache",
        "blog_meta",
        "code_snippets",
        "woo_variation_swatches"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes",
        "theme_json",
        "wordfence",
        "wordfence-ls"
    ]
    Unflushable Groups: []
    Groups Types: {
        "blog-details": "global",
        "blog-id-cache": "global",
        "blog-lookup": "global",
        "global-posts": "global",
        "networks": "global",
        "rss": "global",
        "sites": "global",
        "site-details": "global",
        "site-lookup": "global",
        "site-options": "global",
        "site-transient": "global",
        "users": "global",
        "useremail": "global",
        "userlogins": "global",
        "usermeta": "global",
        "user_meta": "global",
        "userslugs": "global",
        "redis-cache": "global",
        "counts": "ignored",
        "plugins": "ignored",
        "themes": "ignored",
        "blog_meta": "global",
        "theme_json": "ignored",
        "code_snippets": "global",
        "wordfence": "ignored",
        "wordfence-ls": "ignored",
        "woo_variation_swatches": "global"
    }
    Drop-ins: [
        "advanced-cache.php v by ",
        "Redis Object Cache Drop-In v2.4.1 by Till Krüss"
    ]
    Plugin Author Till Krüss

    (@tillkruess)

    Correct, Redis Object Cache will connect to 127.0.0.1:6379 by default without any configuration.

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.