3

I continue to see these pile up. If I clear my template cache, I can hit retry on each and they go away, but that's getting tedious.

enter image description here

I have the following from a P&T support request on these a while back, but is there any way to track down where/why these are happening now? I'm not seeing any deprecated tag errors or anything in the CP, nor am I seeing any template errors on the site, and I have a fair number of pages cached where images are being resized.

Hrm... I see the error that's occurring in your log files when that task tries to complete. What looks like happened was that there was an error in your Twig code somewhere inside of one of your {% cache %} tags and that error actually got cached and saved to the database and that is freaking the DeleteStaleTemplatesCache task out.

Kinda hard to back track which cache tag it occurred in and what part of your template code.

But the way to get it worked again is to clear your template caches manually from Settings->Tools. You should be able to click "retry" on those failed tasks again and they should complete fine.

Thanks!

Mark

  • I looked, but couldn't find the ticket you were referring to. Did we share what the error in the logs was? – Brad Bell Oct 23 '14 at 17:55
  • No, that's all I had. It was July 21st of this year. I'll follow up on Brandon's suggestion. Thanks! – Mark J. Reeves Oct 24 '14 at 12:31
5

When a task actually fails (as opposed to getting stuck), Craft will log an error message explaining why. To fish it up, open craft/storage/runtime/logs/craft.log, and search for:

Encountered an error running task

Each time the task runner encounters an error, its log message will begin with that, followed by the task’s ID, its type, which step it was on (if applicable), and the error message the actual task returned.

If you’re not seeing it, check craft.log.1, craft.log.2, etc.

  • Hi, Brandon! I updated the original question with what looks to be the error. Any thoughts on eliminating it? As a further, tangential follow-up, I've actually been asked to randomize these rather than sort by date. Is that possible? Is it possible within cached template code? Thanks! – Mark J. Reeves Oct 24 '14 at 13:15
  • @MarkJ.Reeves Hey Mark, can you split this up into multiple questions? I answered your first one; understanding how to fix the specific SQL error you’re getting would be another, and the randomization question would be a third. (The best way to ensure that this content will be discoverable and helpful for others down the road is to give each question its own Q&A thread.) – Brandon Kelly Oct 24 '14 at 13:18

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.