What can Cause this?

What can Cause this?

by Tom Wallace -
Number of replies: 5

I have been discussing this problem with Ken Wilson in the installation forum and we have come to a standstill.  He suggested that I post what we had done in the quiz forum since the problem appears to be in the update table when a quiz is attempted.  Hope someone can come up with a suggestion.  here is what has gone before:

What can cause this?
by Tom Wallace - Saturday, 26 April 2008, 10:01 AM

  I am running a single moodle class which contains 31 quizzes, and allows anyone to create their own account.  The server is
Windows 2003 server, with IIS 6.x, Apache 2.2.8, PHP 5.2.5, MySQL 5.0.45, and Moodle 1.8.4.  I continually get the error that the
quiz file cannot be updated.  This message comes from the quiz module.  If I attempt to make a change to a quiz in the
administrator account, I get a similar error, but if I attempt to change anything else I am successful so the error appears to be
in the MySQL database corresponding to the quizzes.

If I restart the MySQL the error goes away and then the quiz can be taken and all of the error prone modules work as expected for
a short while, then the errors occur again.  This happens with both IE6.x and Firefox.

Has anyone else experienced this type of problem?

Thanks.

-------------------------------------------------

 Re: What can cause this?
by Ken Wilson - Monday, 28 April 2008, 12:32 AM

 Tom

Can you please try turning on the MySQL error log. Add something like this line at the end of your my.ini file:

log-error="F:/MySQL/log/mysql.err"

Change the path to suit your own server and restart the service after changing the my.ini file. Let us know what is reported in
the file when the problem re-occurs.

Ken

-------------------------------------------------------------
 Re: What can cause this?
by Tom Wallace - Monday, 28 April 2008, 10:31 AM

  Thanks for the advice.  When I did what you told me to, I went in after restarting MySQL and completed 2 quizzes.  I then
exited the browser without logging out of Moodle, went back in as the same student account and got the same errors.  This is what
was in the Mysql.err file:

080427 22:15:11  InnoDB: Started; log sequence number 0 64941538
080427 22:15:11 [Note] E:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: ready for connections.
Version: '5.0.51a-community-nt'  socket: ''  port: 3306  MySQL Community Edition (GPL)


This was put in the file when the service restarted so it looks like no error was ever registered.

Any other suggestions?  I am open to anything.  Thanks.

--------------------------------------------------------------

 Re: What can cause this?
by Ken Wilson - Monday, 28 April 2008, 01:46 PM

 Can you post back the exact error message you're getting, Tom. I just can't find anything in the Moodle errors which have
something like "quiz file cannot be updated" in them, and it looks like it's not a MySQL problem after all.

-------------------------------------------------------------------------
 Re: What can cause this?
by Tom Wallace - Monday, 28 April 2008, 09:02 PM

  The error is: "Failed to save the current quiz attempt!"   It is on line 393 of attempt.php under Moodle\mod\quiz.  The code is:

/// Update the quiz attempt and the overall grade for the quiz
    if ($responses || $finishattempt) {
        if (!update_record('quiz_attempts', $attempt)) {
            error('Failed to save the current quiz attempt!');
        }
        if (($attempt->attempt > 1 || $attempt->timefinish > 0) and !$attempt->preview) {
            quiz_save_best_grade($quiz);
        }
    }


Hope this helps.

Thanks.

-------------------------------------------------------------------------
 Re: What can cause this?
by Ken Wilson - Monday, 28 April 2008, 09:47 PM

 That's helpful - thanks. Looking at the code behind that function (update_record) the SQL that could generate an error is the
UPDATE statement. A couple of things to try:

Try running a repair on the database or the quiz_attempt table. See this entry in the Admin FAQ. You can also try running the
mdl-db-opt.php script in this post. Before doing anything to your database, remember to make a backup first.
Try turning-on debugging in SIte Admin -> Server -> Debugging -> Developer. Do you see any messages displayed?
Thanks

Ken

--------------------------------------------------------------------
 Re: What can cause this?
by Tom Wallace - Tuesday, 29 April 2008, 10:03 PM

  Thanks for your help.  I have tried everything you have suggested to no avail.   When I run the database repair, everything
comes up OK.  When I turn on the debugging, I get the html code on the buttons and no one can go into a quiz to see what comes up. 
The error logs only show failed login attempts and where an individual goes into a quiz and is given an immediate retry then quiz
close.  No indication as to why.

Any other suggestions?  I am open to anything at this point, including reinstalling.

Thanks again.

--------------------------------------------------------------------
 Re: What can cause this?
by Ken Wilson - Tuesday, 29 April 2008, 10:29 PM

 Thanks for your patience Tom. The essence of this is that something is preventing the mdl_quiz_attempts table from being updated.
It could be file permissions, mysql grant privileges, a corrupt table or simply out of disk space.

If Moodle is working fine and users are accessing the quiz, then it looks like it isn't any of these problems.
Unless someone else has any suggestions, can I suggest that you (a) take this one to the specialists in the Quiz Forum
while (b) try re-installing or upgrading as you wait for a reply.

Sorry I couldn't have been any more helpful!

Ken

------------------------------------------------------------------
 Re: What can cause this?
by Tom Wallace - Monday, 28 April 2008, 09:25 PM

  I can very much be wrong, but it appears that the database is being opened and never closed.  I went back and attempted a
quiz then logged out totally using the logout and then closed the browser.  When I went back in, I received the errors. 
I closed my browser and deleted all the cookies and temporary files then tried again and still received the error.  I changed
to Firefox and still received the error which indicates to me that the error is with the database, Moodle, or PHP and not with
the browser.  The only thing that is consistent in all the attempts is closing the browser.

How is the database closed to an individuals attempt?


Thanks.

Average of ratings: -
In reply to Tom Wallace

Re: What can Cause this?

by Jeffrey Thomas -

Just last night I encountered this same problem!  <<Failed to save the current quiz attempt!>> error message displayed when students tried to navigate to next page of the quiz.  That also displayed when I tried to Update the Quiz.

Resolution?  the C-drive of our server had 500mb space left: we cleared out 1gb of disk space, restarted MySql, and now the quiz works fine.  

Another symptom at the time, repaired after a simple restart of MySQL: MyMoodle displayed error message <<No course information to display>>

A second curious symptom: after the display of that error message, Moodle returned to the quiz page, but in full-frame mode (i.e. no IE frames!).    Now that it works fine, frames display as always.

Our Environment:  Moodle1.8.2, php5.2.5, mysql5.0.22, on Windowsserver2003 running iis.

Why is this happening?   I am already fighting to assure faculty that Moodle is safe and reliable.  This indicates that Moodle is not reliable.

In reply to Jeffrey Thomas

Re: What can Cause this?

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
I think it's not Moodle that is unreliable, but your server setup. A C-drive with 500MB free space is not safe. Check the max size of your swap file: that is the very least you should have free to not block your server completely. This is usually something like 1,5 times the amount of RAM. BUT, a good rule of thumb is to keep your system disk only 50% full to avoid fragmentation.

Your mysql probably ran into problems due to lack of memory, swap or disk space. Try if repairing the tables helps.
In reply to koen roggemans

Re: What can Cause this?

by Tom Wallace -

I appreciate your input, however my circumstance is somewhat different.  I have a dedicated server with 4 zeon processors, 3.99GB free on my C drive and 93GB free on my D drive.  I am using swap files on both drives and still getting the same problem.  Is there a setting within Moodle, PHP, or MySQL that can be increased to allow more space to be used?

My tables have been repaired 4 times and each time reported nothing wrong.

Thanks.

In reply to Jeffrey Thomas

Re: What can Cause this?

by Jeffrey Thomas -

We thought clearing the \TEMP\ directory helped, but evidently it was simply the act of restarting MySQL;  the C-drive now has over 1.5gb of free space, and Moodle still clogs up about every 24 hours;  a restart of MySQL runs fine.

A more frightening symptom of this problem is the disappearance of homework (i.e. assignment submissions -- all courses report Zero assignments submitted!).   A restart of MySQL revitalizes them.

My network admin (Microsoft-certified, but no expert on SQL or Moodle) suspects something in the MySQL setup values; but nothing has changed in 6 months.     Any suggestions?

[And I just last week convinced one key teacher to start using Moodle -- he then writes me yesterday "All the assignments have disappeared!" ... that's a three-month setback to any implementation!]

In reply to Jeffrey Thomas

Re: What can Cause this?

by Jeffrey Thomas -

Update:  this seems to have been caused by a server upgrade of McAfee ViruScan Enterprise... moving from v8.0i  to v8.5i

When we downgraded back to v8.0, Moodle (i.e. MySQL database tables) responded normally again.

Yikes!  Another user on a MySQL forum solved it by excluding all the MySQL databases from the virus scan.  That sounds like a kludge, no?    

Does anyone else have experience with this?   We will bother McAfee customer service about it, to see what they say.