6

I have a Joomla site which has had persistent on-going problems with its cache.

We are able to resolve these problems as they happen by going to the admin panel and clearing the caches, but would obviously prefer if they didn't happen at all. But I am having difficulty trying to debug the problem find out the underlying cause.

The symptoms are that the site operates normally for a period of time, and then suddenly starts giving blank pages with a 500 error. The issue seems to be worse now after a recent upgrade to Joomla 3.8.

I've done some debugging, and the actual crash is an out of memory error. The exact location varies, but the latest example gave me this:

Allowed memory size of 268435456 bytes exhausted (tried to allocate 30548627 bytes) .../libraries/src/Cache/Storage/FileStorage.php:195

This is in the FileStorage::store() method, trying to add a block of code to the cache.

Looking at the contents of $data at this point, it is serialized PHP data that contains numerous copies of all the modules on the homepage, and the size of the data is large enough that it pushes us over the memory limit when we try to prepend to it.

There are definitely multiple instances of all the modules, and my guess is that they are building up in the cache over time until it gets too big for the memory limit.

What I don't understand (and can't work out from the debugging I've done) is why this would be happening. By the time the fatal error occurs, it's already way past the point where it's actually built this big structure full of modules, and I don't have the deep knowledge of Joomla's internals to allow me to dig any further.

Can anyone out there give me some pointers as to what might be happening here and how to resolve it permanently?

Thank you.

  • Have you looked at your PHP settings - this could be a PHP memory issue? You may need to increase it. – Dtorr1981 Nov 7 '17 at 13:30
  • @Dtorr1981 - I have done. We have memory_limit = 256M, which I feel should be sufficient. Indeed, it is sufficient most of the time. – Simba Nov 7 '17 at 13:34
  • I have had instances where for whatever reason, likely the components i'm using, I have had to up this to 512MB. Are you using JotCache or is it the standard Joomla cache? – Dtorr1981 Nov 7 '17 at 13:35
  • Using standard cache. Re upping the memory limit, yes; I'm going to do that. But I'm concerned doing that will just push the problem further down the path. If it's doing what I think, and adding more and more copies of the modules over time, it will eventually crash whatever limit I give it. – Simba Nov 7 '17 at 14:07
  • I've got the cache set to "Progressive Cache". I'm wondering whether the solution is to switch it to "Conservative Cache"? – Simba Nov 7 '17 at 14:43
3

Switch to conservative caching, progressive caching should be avoided. You will run into all sorts of issues because of progressive caching, including, but not limited to, memory issues and file system issues. Not to mention, of course, that because of all these constant file writes caused by progressive caching, you may run into hardware failure.

Very few Joomla sites really need to use progressive caching, and those sites that actually need it, end up using something else. Progressive caching is not well coded and it is much, much worse in Joomla 3.8.

By the way, if you have that memory limit set to 256 MB because you are running into issues because of the use of progressive caching, then I suggest you reduce that number to a manageable 64 MB (after you switch to conservative caching). 256 MB is too high and is seldom necessary on a Joomla site.

  • thanks for the answer. The article you linked is for J2.5, but I guess the situation is much the same for J3. Very interesting. It's not easy to find useful info resources about this topic, so the explanation was helpful. Thanks. – Simba Nov 9 '17 at 13:40
  • No problem! The article still applies to Joomla 3, the concepts haven't really changed. – itoctopus Nov 9 '17 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.