3.3.2+ localcache filling up hard drive

3.3.2+ localcache filling up hard drive

by Joel R Smith -
Number of replies: 10

I noticed yesterday that my server's hard drive had filled up from files generating in moodledata\localcache. There are all of these long folder names like 8e6e6739-70c9-454a-adbe-8f5e323cf4ff and inside are some more folders with similar names and then in side of each of those folders is a single pdf labelled error.pdf. All of the error.pdf documents say "There was an error while generating this page". When I delete the files, more will show up, sometime right away, sometimes after a few minutes. 


Not really sure where to go from here. This has been happening since September with a previous version of Moodle (I think it was 3.3). Noticed it after the hard drive filled up! Updating to latest never changed anything. I went into debugging, set it to log errors & checked the php error log but nothing is showing up. Any advice is appreciated.

Environment: Latest Moodle from Nov. 3, Server 2008 R2, IIS7, MySql 5.5, PHP7.0.9

Average of ratings: -
In reply to Joel R Smith

Re: 3.3.2+ localcache filling up hard drive

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Possibly, your unoconv setup is incorrect or broken and needs to be fixed. Sorry, I don't use IIS and MS server.

In reply to AL Rachels

Re: 3.3.2+ localcache filling up hard drive

by Joel R Smith -

Not that...it's a pretty vanilla install of Moodle with no extras like that installed. So I tried denying "write" privileges to the local computer administrator account (not the iusr account) and right away I noticed this error message in the php errors log. It's shown up twice so far in the past few minutes. There were no errors in the event log of any kind for the past several months so I am thinking there is a relationship.

[06-Nov-2017 19:36:24 America/Edmonton] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 229376 bytes) in C:\inetpub\wwwroot\moodle\lib\tcpdf\fonts\freeserif.php on line 15

In reply to Joel R Smith

Re: 3.3.2+ localcache filling up hard drive

by Joel R Smith -

As a follow up to this, I can confirm that denying "write" privileges to the local computer administrator account  for the folder c:\moodledata\localcache has stopped the generation of these mystery folders & pdf files. However, I am now seeing my php error log pile up with this new error message to do with freeserif.php on line 15 (see above). I've seen 20 of these new error messages in the past 1.5 hours. 

I'm still at a loss to explain how these pdf files could have possibly been generated.

In reply to Joel R Smith

Re: 3.3.2+ localcache filling up hard drive

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Joel,

Let's say you create an assignment,  a student submits their work, then you go to grade it...Moodle will automatically try to convert whatever was submitted, into a pdf that the teacher can mark on. Because the conversions take some amount of time, cron is set to try to convert them and have them ready when the teacher goes to grade the assignment. If there is something wrong with you conversion setup, you will get all of those failed attempts that you found.

You need to go to Site administration > Plugins > Document converters and see if you have Unoconv or Google drive setup to handle the conversions. Either one is okay, but you can see that Unoconv has a much bigger list of what it can convert.

You should also see a link for Test unoconv path. Click it and if things are set correctly, you should see the message, The unoconv path appears to be properly configured, with another link, Download the converted pdf test file, plus a Continue button.

You can also see that there is a link, Google Drive, and when clicked, you can test if it is working.

Both of these convertors require some setup and do NOT work correctly until you do.

Average of ratings:Useful (1)
In reply to AL Rachels

Re: 3.3.2+ localcache filling up hard drive

by Joel R Smith -
Thanks for that info. I saw that both of the plugins were DISABLED on my site. I proceeded to uninstall unoconf & deleted the files from the moodle directory. After doing that I removed the write prohibit from the localcache folder. 


The problem appears to be resolved. No files are being generated in the localcache folder & no error messages are showing up in the php log. There must be a bug with that module.

In reply to Joel R Smith

Re: 3.3.2+ localcache filling up hard drive

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Not so much a bug, but an admin MUST set it up to get it to working correctly. If the admin does not set it up, then you can get problems, like the one you've had.
In reply to AL Rachels

Re: 3.3.2+ localcache filling up hard drive

by Joel R Smith -

So to give an update, the issue wasn't unoconv at all. After completely deleting the module from moodle I noticed the files starting to generate around 5PM last night. By 9AM this morning I had to delete 1.2GB from localcache.

I copied back the unoconv directory in case I decide to add it back later. I also added back the "write deny" privilege to the local administrator account. About 5 minutes after doing that i'm now seeing the same error in the php log:

[08-Nov-2017 09:07:16 America/Edmonton] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 229376 bytes) in C:\inetpub\wwwroot\moodle\lib\tcpdf\fonts\freeserif.php on line 14

This issue is related to whatever is erroring out on line 14 of freeserif.php, but i'm not a coder so if someone else can check into that file I would really appreciate it!

In reply to Joel R Smith

Re: 3.3.2+ localcache filling up hard drive

by Ken Task -
Picture of Particularly helpful Moodlers

That line is an array ... bunch of data.

Error is telling you that what is currently set in php for memory for a script to consume:

which shows to be 536870912 bytes (or 536.8 Meg).   The script is trying to use 229376 bytes more - which is only 0.2 Meg

So 540M?

So have you tried allocating (setting) more memory to the running of scripts just a little more ...

Restart of web service require when making changes to php.

'spirit of sharing', Ken

In reply to Ken Task

Re: 3.3.2+ localcache filling up hard drive

by Joel R Smith -

I traced the problem back to the scheduled task "Prepare submissions for annotation". Running that script without unoconv configured seems to do create all of these error messages. I noticed a related post here: https://moodle.org/mod/forum/discuss.php?d=359180

I resolved the problem by fully configuring unoconv. We've never used it before but it might be useful.

In reply to Joel R Smith

Re: 3.3.2+ localcache filling up hard drive

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Joel,

Glad to hear you have resolved the problem. Once you experiment with marking directly on submissions, you will probably wind up using it more and more. At least I did before I retired. With my MS Surface Pro and pen, it was like grading "papers" again, which for me, just seemed to go faster than trying to type an explanation of what was wrong with a submission, be it writing, pictures, drawings, spreadsheet, etc., or anything else that could be converted to PDF.