I maintain a website where we are using Moodle version 1.9.9+ (Build: 20100707). For those of you who don’t know, Moodle is a open source course management system in PHP which is used by education institutions to deliver educational content to students.
Moodle has developed a serious problem. First, let me say that we have done no modifications to Moodle in a very long time and it has been behaving very nicely for us.
Recently, however, we have begun receiving sporadic notifications of server (HTTP 500) errors when trying to write to the Moodle log table. It occasionally shows up on the screen while a teacher is attempting attempting to do administrative tasks such as creating new content in a course, or changing course settings. For example, clicking a button to submit changes to a page will have no effect. The data is not saved and the page does not refresh. Students do not have this problem. The system appears stable and functional for student use.
Moodle may send us an email whenever this happens. Here is a typical email message:
“Insert into log table failed at Wednesday 20th of June 2012 11:15:55 AM.
It is possible that your disk is full.
The failed SQL is:
INSERT INTO mdl_log (time, userid, course, ip, module, cmid, action, url, info)
VALUES ('1340208955', '3', '1', '126.96.36.199', 'user', '0', 'logout', 'view.php?id=3&course=1', '3')”
These errors always indicate the problem involves mdl_log during a mySQL INSERT. Once one of these errors occurs, Moodle will hang. Or it may hang without generating this email message. I checked the Moodle developer’s forum and it appears this email message has been set up in Moodle by the developers to provide some sort of error message when there is a failure to write to the log.
We have repaired the mdl_log table to no avail. The errors keep coming. Also, I have been assured there is ample disk space, so we know the disk is not full. I am able to manually perform operations on the Moodle log, using phpMyAdmin, so it does not appear that the database is the issue.
I have tried reducing the size of mdl_log (from 19,000 to 9000 rows) to no avail. I also did a repair on the table, but it also failed to fix the problem. Cleaning out the log table and resetting the auto increment likewise had no effect. Recreating the Moodle database through an export and import to a new database was also fruitless. No other database functions on the website are affected.
My hosting providers says the server logs are not showing any error messages, although they did find that Moodle is frequently trying to perform some sort of functions which are timing out (more than 30 minutes!). Nothing in Moodle takes that long to run. I have turned on developer debugging, but the crashes fail to generate any error messages.
There are no backups running and no cron jobs either when these crashes occur. The only cron job runs at midnight.
What may be the cause of this and how do we approach fixing it?