Exception - Failed to write cache file

Exception - Failed to write cache file

by Perry Way -
Number of replies: 3

Hello everyone, Thanks to all those who helped on previous questions related to our ransomware attack and subsequent problems with an incomplete Moodledata backup.

Our site logo is not showing. It used to until I cleared the cache one day, then we started getting a lot of problems that were not there before the cache was cleared. This time the issue is related to clearing the Theme cache. So I tried to delete the logo first and then re-upload the same file in place. At which point I got this error:

Exception - Failed to write cache file 

"[localcachedir]/mustache/1632255516/laurus/__Mustache_da8c58934baeaf82ad906f667e9f5226.php".

When I inspect the Moodledata/localcache/mustache folder I see clearly there's no 1632255516 folder in there. However there's a 1632255862 folder. And the rest of the path (/laurus/__Mustache_da8c58934baeaf82ad906f667e9f5226.php) shown above renders down to the right file. It exists. 

My question is what is causing this discrepancy, and then how to fix this? 1632255516 should be 1632255862

Average of ratings: -
In reply to Perry Way

Re: Exception - Failed to write cache file

by Ken Task -
Picture of Particularly helpful Moodlers

Think the number is an epoch time stamp.

Check your scheduled task list for anything 'cache'.   If you have path to php-cli set in system paths, there will be a 'run now' link.

IF web service has read/write access to that 'localcachedir' and subdirectories there in, run now on the right cache clean up should correct that. (me thinks).

'SoS', Ken

In reply to Ken Task

Re: Exception - Failed to write cache file

by Perry Way -
Hi Ken,

Well, that didn't help. Some changes have happened though with respect to the behavior.

Now when I upload the logos ("Logo" and "Compact Logo") I get no error as before, but ultimately the same effect happens which has happened all along, which is the logo does not show and in it's place is the text you would see should you hover over an image (the "hint").

At this time I think I need to figure out why the logo doesn't show, since the error I got is no longer happening. I thought the error was part of the overall picture, but it seems that got rectified by scheduled tasks which ran last night 7:30 pm and took care of all the caching items in scheduled tasks. (I verified with our log files which are outputted to disk every time the "cron" is run).

Any clues as to why logos would not show? They used to until I cleared the cache like last week or maybe even the week before.
In reply to Perry Way

Re: Exception - Failed to write cache file

by Perry Way -
I am back to report on a success, and what it took to do so. Our Moodledata folder was "mangled" due to restoring from a faulty backup providing an incomplete listing of files.

I developed some software to clean up the Moodledata folder and created a temporary site to backup/restore our live site to so I could test this out first. On that site I executed my software to cleanup that Moodledata folder. Once it was finished, I attempted to load the site logo and once I did that it worked on the temporary site. I have no doubt this will work on our live site as well, it's just that I haven't done that work yet. I'm waiting for a thumbs up from some of our administrators to check to see if everything is working in the temporary site first, then after that thumbs up, I'll do the same thing with our live site.