• I’ve got a setup with three very specific plugins, including yours, that is leading to a weird issue with some kind of default value coming out of Redis. The data being cached into Redis that I’m having trouble with belongs to a very post-and-plugin specific key (a piece of WP Offload Media data that they cache specific to a single media item). On cached visits to a very specific page, the key is getting the value “r:364;” back from Redis.

    I’ve set up a “listener” (a dump function) in WP_Object_Cache‘s get and set methods that looks for the key causing issues. Then I’ve flushed the Redis cache via the Settings screen. I can then hit a particular URL (FWIW, Modern Tribe’s Events Calendar’s new list view, which includes an event that has a featured image that requires that cached data) twice (once fresh, once from cache) and see the following play out:

    1. Page load 1. Redis cache has just been flushed.
    2. The WP Offload Media cache key is saved, running through the set method from WP_Object_Cache, with an object as the value:
    `
    ^ DeliciousBrains\WP_Offload_Media\Items\Media_Library_Item {#2596 ▼
    -id: “61”
    -provider: “do”
    -region: “sfo2”
    -bucket: “run-hub-nw-3”
    -path: “app/uploads/2015/05/08120434/GroupRunWarmUp.jpg”
    -original_path: “app/uploads/2015/05/08120434/GroupRunWarmUp.jpg”
    -is_private: “0”
    -source_id: “20466”
    -source_path: “2015/05/GroupRunWarmUp.jpg”
    -original_source_path: “2015/05/GroupRunWarmUp.jpg”
    -extra_info: “a:1:{s:13:”private_sizes”;a:1:{s:13:”private_sizes”;a:0:{}}}”
    }
    `
    3. Refresh – page load 2, cached data now available.
    4. That same key is fetched, running through Redis Cache’s get method. Redis returns the value “r:364;”.
    5. Offload Media plugin throws fatal PHP error because it got a string instead of an object.

    The key in question is only saved to the cache the one time, as outlined above. Can’t figure out why it’s getting something totally different back out of the database. The same thing is happening, presumably, for all the other media on the page, but the value is being saved and retrieved properly, as an object.

    I assumed maybe that string is some kind of fringe default value in an edge error case, but a Google didn’t turn up anything. Does it mean anything to you?

    • This topic was modified 4 years, 8 months ago by eclev91.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter eclev91

    (@eclev91)

    Redis v 5.0.7. Redis Cache plugin is up-to-date, as is the drop-in.

    Plugin Author Till Krüss

    (@tillkruess)

    That sounds like a serialization issue. What’s your config?

    Thread Starter eclev91

    (@eclev91)

    Like my Redis config? As set for WP purposes or elsewhere?

    Config::define('WP_REDIS_HOST', (env('WP_REDIS_HOST') ?? '127.0.0.1'));
    
    Config::define('WP_REDIS_DATABASE', (env('WP_REDIS_DATABASE') ?? 0));
    
    if(env('WP_CACHE_KEY_SALT')):
        Config::define('WP_CACHE_KEY_SALT', env('WP_CACHE_KEY_SALT'));
    endif;
    
    if(env('WP_REDIS_DISABLED')):
        Config::define('WP_REDIS_DISABLED', env('WP_REDIS_DISABLED'));
    endif;
    
    /**
     * Force PHPRedis, Predis no longer maintained
     */
    Config::define('WP_REDIS_CLIENT', env('WP_REDIS_CLIENT') ?? 'pecl');
    WP_CACHE_KEY_SALT=somesaltforlocalas
    WP_REDIS_HOST=192.168.7.7
    WP_REDIS_DATABASE=2
    Plugin Author Till Krüss

    (@tillkruess)

    Mhh. So no custom serializer. Also Sage? ??

    This might be worth debugging over Zoom. Reach out to me at till at kruss dot io.

    Thread Starter eclev91

    (@eclev91)

    Will do, we can set an appointment.

    Bedrock, haven’t gone full Sage for any projects yet!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Edge case with strange default value being returned’ is closed to new replies.