Link to home
Create AccountLog in
Avatar of gpinzino
gpinzino

asked on

Moodle log error and Moodle crashes

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', '99.108.217.201', '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?
Avatar of gpinzino
gpinzino

ASKER

Additional information:
We had entered a new course recently, and I went into the course ad administration and clicked on settings in the Administration panel. I made no changes in the Edit course settings page, but simply clicked on the Save changes button. I was able to trap a brief screen of error messages. The screen shot is attached.

All of the errors are related. They refer to an undefined index for either month or day in dataselector.php (either line 203 or 204).

Could this be a clue about the source of the problem?

User generated image
Avatar of noci
Although you didn't update moodle, was PHP updated?
Recent PHP versions became more vocal about "creative use" of PHP language use.
And after some period of warnings now also breaks on the formerly allowed creative use.
[ PHP did have a few security related updates earlier this year ].

The index mentioned in you Notices most probably is an array reference in PHP.
It might or might not be related to your database problem.

(dateselector.php is about date manipulation and is used to generate timestamps f.e.)
Thanks for the tip on the timestamps, Noci. I will examine the database and see if that gives me a clue as to why the lockups.

Moodle is running on PHP 4. I don't know whether our hosting provider has performed any updates to it. One reason we have not upgraded Moodle is because it would require us to switch to PHP5. I tried switching to PHP5 and it took us about two minutes to realize that a large portion of the rest of our website would need to be debugged to run under the new version.

I will check with our hosting provider to determine what, if any, PHP4 updates have been done recently.
ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I think I have it fixed. Changing PHP versions did not resolve the provlem, PHP4, 5.2 and5.3 all responded the same way and crashed under similar circumstances. Reinstalling Moodle seems to have fixed the problem. I wish I knew what it was. It will take a day or two of intensive use to know for sure.
I awarded noci the points because he hung with and provided thoughtful options and information throughout this ordeal. Thanks noci.
thanks, good luck with your setup.