Givewp: fix(donation): Address why donations are saved to the DB as $0 when memcache is enabled on Dreamhost

Created on 8 May 2018  路  6Comments  路  Source: impress-org/givewp

User Story


As a Give Admin who is hosted on Dreamhost's DreamPress package, I expect to be able to use Give effectively with donation data being saved correctly to the database.

In working with @Ipstenu on this, we identified the following:

Each Dreamhost user has the following in common:

  • They're on the new DreamPress boxes (which have been available as of summer 2017)
  • They moved to DreamPress in April
  • They're on PHP 7.1.16
  • We last updated Memcached in February 2017 (last year)

Current Behavior

Currently, donations are processed correctly, but when the donor gets to the Donation Confirmation page, it shows the donation total as $0. That is also saved to the database as $0. This means that the only way to get Give to show an accurate amount is to log into my payment processor, get the right amount, update the amount in the Give Donation Details screen (or directly to the database).

This only happens when Deamhost's memcache is enabled.

Expected Behavior

I expect to have the donation total be correctly saved to the database and reflected correctly on the donation confirmation and history pages for the donor as well as in the Donation Details screen.

Possible Solution

Currently, the only workaround is for the user to disable memcache completely. This isn't a viable workaround and will create a lack of faith in Give for any user on this platform.

Steps to Reproduce

I have a test environment from which this can be replicated. #TeamGive developers can ping me for it.

Visuals

_The $1 donation was made AFTER memcache was disabled_
image

Related

_The following are for #TeamGive access only_

Tasks

  • [ ] Confirm the memcache problem in the test environment.
  • [ ] Confirm whether there is anything we can do programmatically to avoid that problem in our code based.
  • [ ] If there is a fix, implement it. Otherwise, update this ticket with any additional insight into what might be necessary for these users to be able to use Give successfully.

Most helpful comment

Holy schnikes, @ravinderk ! That was a GREAT catch!

All 6 comments

@ravinderk Quick update:

I've been testing this Dreamhost issue for days now. Mika and I narrowed it down to NOT just be memcache, but a combo of Give + {mystery plugin/theme} + memcache. Right now, my best lead is that is MIGHT be Avada because that is consistent on both environments I have access to.

More notes from Dreamhost folks:

So far, I found Avada does a lot of resetting of caches all over the place (you can see ob_start() in a bunch of places)
...there are times when something tries to save too much data into the database, it can overload the cache.
Avada can store the CSS in the db - https://theme-fusion.com/avada-doc/special-features/css-compiler/

@DevinWalker @mathetos I found the issue is in Avada theme. Basically, it is not good to invalidate each cache element without knowing about it.

Avada theme is invalidating all cache on every save_post and delete_post hook. Which cause of generating bad cache for Give or maybe for other plugin.

Before: Not working with it
image

After: This will resolve issue, but need to discuss with Avada support
image

Holy schnikes, @ravinderk ! That was a GREAT catch!

Was this page helpful?
0 / 5 - 0 ratings