So all my background tasks Craft 3.2.6 seem to process ok except deleting stale template caches. Although craft is supposed to fail after 5 minutes, it fails instantly and the error log shows

Allowed memory size of 1610612736 bytes exhausted (tried to allocate 380928 bytes) 

Server settings for memory are 512M and 300 second timeout. The error is instant - in that the error log is immediately populated on saving an entry - which makes me think that this is not the real problem. The server is running Nginx as a reverse proxy for apache and uses microcaching and I wonder if this might interfere with that one task? Its a multisite with 8 languages and I guess quite heavy on the fields and image processing. How can I debug this further - short of giving the whole dedicated box memory to this one site?

  • I'm fighting with a similar issue (Craft tried to allocate more memory, increase timeout, but those are not scalable solutions, the deleting jobs are eating up everything you give them.. (Now 2G memory and 600s exec time is already not enough) After flushing the cache the first jobs have already 40K+ steps to complete.. and the number grows exponentially.. some hours later it's 100K+.. I've looked into the queue logs and I see couple of interesting things: 1. There is nothing about deletion. I see only SELECT and UPDATE queries. 2. Everything is logged 3x. (I hope only the logging
    – peet86
    Jan 8 '20 at 8:14
  • I think its a cache tag problem - this is still ongoing for me but i need to strip out all cache tags and test
    – joomkit
    Jan 17 '20 at 18:52

Anything in queue.log that gives us hints? Anyway if it is just the stale template caches task... I'd just truncate the cache tables manually (n.b.: truncate, not delete):


You only need to truncate that one cache table, because it'll cascade can remove the other related columns in templatecacheelements and templatecachequeries as well.

Then I'd truncate the queue table as well to remove the no longer needed stale template cache queue jobs.

Learn more:

  • Yikes - my templatecachequeries table was 3GB.Not sure how it got that outta hand but emptying queue table wasn't sufficient. I'd all but removed cache tag too. Once i cleared that all seems to be sweet
    – joomkit
    Jul 24 '19 at 15:23

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.