site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Object caching can interfere with module activation

Open adamsilverstein opened this issue 7 years ago • 14 comments

Bug Description

When attempting to activate a module (eg. Analytics) in an object cached environment, the activation status update may appear to fail.

Steps to reproduce

  1. In an object cached environment set up the plugin and attempt to activate the Analytics module

Expected result: Module is activated, setup flow continues.

Actual results: Module not activated, page shows error. Clearing the object cache at this point and reloading causes setup to continue as expected.

Screenshots

Failure: image

REST request to module/analytics active:true returns active: false: image

Analytics Module missing after activating: image

Additional Context

@westonruter can you provide any additional details around your caching environment?

  • PHP Version:
  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Plugin Version [e.g. 22]
  • Device: [e.g. iPhone6]

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Changelog entry

adamsilverstein avatar Aug 19 '19 18:08 adamsilverstein

I was trying this on my Pantheon-hosted production environment:

  • PHP 7.2
  • WP Redis object caching plugin
  • Plugin version: 1.0.0-beta.1.0.4

westonruter avatar Aug 19 '19 19:08 westonruter

@adamsilverstein agree this is quite a frustrating issue, I've encountered it a few times myself while testing and doing demos. It could stump a lot of users, especially the less savvy ones. If it's possible to figure out what exactly is causing this and how we can clear that specific part of the object cache, that would be great. Then I can define more specific ACs for what should change.

marrrmarrr avatar Oct 10 '19 12:10 marrrmarrr

I'll dig into this a bit further to see how we can mitigate.

adamsilverstein avatar Oct 10 '19 12:10 adamsilverstein

Sorry, but for clarification: what does "object caching" mean here? Is it specifically using the https://wordpress.org/plugins/wp-redis/ plugin or any other type of server-side/PHP object cache?

tofumatt avatar Oct 10 '19 13:10 tofumatt

Sorry, but for clarification: what does "object caching" mean here? Is it specifically using the https://wordpress.org/plugins/wp-redis/ plugin or any other type of server-side/PHP object cache?

Object caching is essentially WP_Object_Cache which is core's caching layer where things like posts, meta, and options are kept to prevent querying the database every time these are requested. By default, this is a simple in-memory implementation which only lasts for the current request. However, it is possible (and sometimes necessary) to use alternate implementations of WP_Object_Cache which use other backends as persistent, external object caches. The two most popular options are Redis and Memcache. In order to use them, you need to have access to the cache backend, not just the plugin 😄

aaemnnosttv avatar Nov 15 '19 10:11 aaemnnosttv

@cole10up it would be great to have a look if this is still an issue. If not, we can close it.

marrrmarrr avatar Jan 10 '20 15:01 marrrmarrr

Tested:

Enabled Object Cache image

Confirmed Existing configuration of Analytics functions image

Uninstalled and tried new setup Also functioned. Going to chat with @aaemnnosttv about other scenarios to try on the backend tomorrow.

cole10up avatar Jan 14 '20 05:01 cole10up

@cole10up I see you installed the Redis plugin but it looks like it's not connected to a Redis backend so the persistent object cache won't work yet. image Ping me and I'll see about helping you get this set up locally.

aaemnnosttv avatar Jan 14 '20 07:01 aaemnnosttv

Tested Ran some tests with @aaemnnosttv using evanmattson.10uplabs.com

image

Didn't see this issue. Going to reach out to try on a Pantheon hosted environment next.

cole10up avatar Jan 14 '20 16:01 cole10up

Hey @cole10up, have you heard anything from Pantheon on this one?

marrrmarrr avatar Jan 28 '20 14:01 marrrmarrr

Hey @marrrmarrr, we've got a service ticket in on our end to get access to a Pantheon environment as of yesterday. I will followup tomorrow on the status of the ticket if I don't get access today.

cole10up avatar Jan 28 '20 17:01 cole10up

I have access to Pantheon, working through the setup and will have feedback tomorrow.

cole10up avatar Jan 29 '20 19:01 cole10up

Tested

Setup Pantheon server with Redis object caching. image

  • Installed and activated latest develop build of SK
  • Setup SK and configured Analytics
  • Confirmed Analytics on the dashboard is displayed and no errors occurred image

Confirmed Tag Manager, Search Console, and Page Speed Insights also functioned properly.

Wasn't able to reproduce this issue on the latest pre 1.3 build @marrrmarrr

cole10up avatar Jan 30 '20 04:01 cole10up

Closing since it is not reproducable

ThierryA avatar Feb 11 '20 14:02 ThierryA