- π·πΊRussia skylord
Tried #40 with "cache.backend.memcache_transaction_aware" as backend on site with huge traffic and slow DB (so the chance for race conditions is bigger) - no way, still the same behaviour. Node saving process started, cache is invalidated first, someone requests page, cache is populated with old data, then node actually saves in DB and we got stale cache until i manually invalidate appropriate cache tag using drush... With DB or Redis backend all is OK on that site!
- Status changed to Needs work
over 1 year ago 3:55pm 2 March 2023 - π¦π²Armenia arthur.baghdasar
We are seeing same behaviour as per #41
- Status changed to Needs review
over 1 year ago 8:42pm 1 August 2023 - πΊπΈUnited States weekbeforenext Asheville, NC
The patch in comment #40 worked for me. I had reported an issue with the Diff module ( π Stale cache when latest revision is published (content moderation) Closed: won't fix ) which ended up being related to Memcached. I'm not sure of the overall implications of this patch and it's affects on performance, but it does resolve what I described in the related issue.
- Status changed to Needs work
over 1 year ago 9:43pm 1 August 2023 - Status changed to Needs review
10 months ago 2:09am 26 January 2024 - π³πΏNew Zealand ericgsmith
We have been encountering what I suspect to be this issue. I was able to reproduce the same issue using the patch in 40 locally, and tracked it down to be stale data in the entity cache. When reset cache is called by entity storage, it is calling deleteMultiple which appeared to be happening immediately and not buffering until the transaction was complete.
Looking through it, it looks like implementation of deleteMultiple was just missing from the transaction aware backend - added it and can no longer reproduce what I was encountering. Still doing some testing but it looks really good - thank you Josh!
Would be interested if the deleteMultiple / entity cache issue is what was causing the continued issues in 36, 38, 41 and 43.
- Status changed to Needs work
9 months ago 4:19am 15 February 2024 - π³πΏNew Zealand ericgsmith
Move the MR and made an attempt at adding some tests.
Unfortunately the existing MemcacheBackendTest is failing - and this test will have the exact same failures. I posted here https://www.drupal.org/project/memcache/issues/3397864#comment-15438674 π Add optional DDEV dev environment Needs review but could not find an open issue where the tests are still being worked on.
Ignoring the pre failing tests - the 2 new test methods I've added are very rough, they pass locally but I'm not sure what the state of CI will be. They need work, so leaving as needs work.
- Status changed to Needs review
9 months ago 8:27pm 15 February 2024 - π³πΏNew Zealand ericgsmith
Test failures for both MemcacheBackendTest and TransactionAwareMemcacheBackendTest both reduced by changing the tolerance to 0 for the timestamp invalidator.
Setting back to needs review as I'm drifting into changing existing test failures here. The additional tests cover the get set and delete during transaction and with a rollback. This isn't full test coverage but I think with the existing failures its hard to press through without full confidence in them. I think getting the existing tests all passing in CI in a different issue will make this easier to review.
I'm still very interested in if the fix in #45 will resolve the errors reported in #36, #38, #41 and #43.
- π³πΏNew Zealand ericgsmith
Adding π Test coverage Active as a related issue to track existing issues with test failures.
- πΊπΈUnited States btully
I can confirm that patch #45 appears to have solved the issue of stale content for a site using considerable nested entities (paragraphs), using cache.backend.memcache as their default backend and where a node edit form might take 10 seconds or more to submit while the node being edited is receiving traffic.
To reproduce the issue I developed a simple JMeter test to request the test page as an anonymous user with a cachebusing query string. The test runs with 10 concurrent users.
While the load test is running, I manually edit the test page, which contains paragraphs. I edit one of the paragraph components and update the title and kicker fields. I submit the node edit form.
Prior to the patch, the node edit form would submit, but the embedded paragraph form fields that were updated do not appear on page load AND/OR when reloading the node edit page. It seems as though the race condition of a simultaneous anonymouse user request for the page has memcache get the old/stale values before they can be deleted and populated with the new values.
After applying the patch and changing the default cache backend from cache.backend.memcache to cache.backend.memcache_transaction_aware, and clearing Drupal and Varnish cache, I repeated my reproducible steps.
With the patch applied, I immediately saw the new values for both fields as both an authenticated and anonymous user. Reloading the node edit form also showed the updated values.
I went through the reproducible steps 3 times, and all 3 times the new values were displaying, which leads me to believe this patch (#45) is working as expected!
- πΊπΈUnited States btully
I take my last comment back. While the patch appeared to be working for about a week or so, I am suddenly seeing the following error even though the service and FactoryInterface are present in the codebase:
You have requested a non-existent service "cache.backend.memcache_transaction_aware".
Is there a specific place the `cache.backend.memcache_transaction_aware` needs to be defined? I have the following in my in docroot/sites/settings/global.settings.php:
$settings['cache']['default'] = 'cache.backend.memcache_transaction_aware';
Like I said, it was working for about a week, but with a recent deployment that changed the code to a branch without the patch, now when we switch the code back to the branch with the patch (and settings) we are getting the above error.
Is there someplace else the new service needs to be explicitly defined/injected?
Memcache module is enabled and I can see the new cache.backend.memcache_transaction_aware service in memcache.services.yml
But for some reason, even after a cache rebuild, Drupal is saying the service isn't defined.
Could opcache be to blame?