Cron hangs: looking for quiz overdue quiz attempts

Cron hangs: looking for quiz overdue quiz attempts

by Radhika Vathsan -
Number of replies: 9

Hi,

We just upgraded from 1.9 thru 2.2 to 2.3.1 and the first time we ran cron.php

it got indefinitely stuck at the line " Looking for quiz overdue quiz attempts between Thursday, 1 January 1970, 5:30 AM and Wednesday, 18 July 2012, 12:53 PM..."!

I did land up at some tracker pages while hunting for a solution but did not get what I can do to resolve this! can someone help please?

Our server is a Centos 6 with php version 5.3.9 (zend).

Thanks!

Radhika

Average of ratings: -
In reply to Radhika Vathsan

Re: Cron hangs: looking for quiz overdue quiz attempts

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well done for finding the tracker issues. To explain them:

Basically, the new code in Moodle 2.3 works find if you database just contains correct data. However, if you have an old Moodle site that have been upgraded through several versions, then you tend to end up with a certain amount of garbage data in the database.

The cron code was not robust enough in the face of that old data, and two separate issues were reported. I think I done fixes for those issues yesterday, and the fixes should be reviewed and integrated into Moodle next week.

So, the simplest option is for you to wait until about Thursday or Friday next week, and then try upgrading to the latest 2.3.1+ weekly build.

The more complex option is to try to download the proposed fixes from MDL-34251 and MDL-34351, and apply them to your Moodle right now. If you did that, it would be useful testing, but you need some technical skills (mainly knowledge of git) to be able to do that.

Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Cron hangs: looking for quiz overdue quiz attempts

by Geoffrey Rowland -
Picture of Plugin developers

I have a similar issue after updating 1.9 ->2.2->2.3.1+

Have tried the above diffs (MDL-34251 and MDL-34351), but to no avail.

Symptoms are slightly different

Processing module function quiz_cron ...
  Looking for quiz overdue quiz attempts between Thursday, 1 January 1970, 12:00 AM and Thursday, 19 July 2012, 1:56 AM...
!!! Can not find data record in database table course. !!!
!! SELECT * FROM {course} WHERE id = ?
[array (
  0 => '0',
)]
Error code: invalidrecord !!
!! Stack trace: * line 1321 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
* line 1297 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
* line 69 of /mod/quiz/cronlib.php: call to moodle_database->get_record()
* line 469 of /mod/quiz/lib.php: call to mod_quiz_overdue_attempt_updater->update_overdue_attempts()
* line 259 of /lib/cronlib.php: call to quiz_cron()
* line 88 of /admin/cron.php: call to cron_run()
 !!

Any suggestions would be most welcome - in the meantime have just hidden Quizzes. So, at least the cron job can run.
Also, have an archive site of the original 1.9. instance.


Thanks in advance
In reply to Geoffrey Rowland

Re: Cron hangs: looking for quiz overdue quiz attempts

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That one looks like you have quizzes and quiz attempts in your database that have been left hanging around even though the cousre they were once part of has been deleted.

Obviously, that should not happen, but it will have been caused by an old software bug.

And, the fix for MDL-34351 is not quite enough to fix that. Really, the try of the try - catch block needs to be moved to just after the foreach ... line. Are you able to try that?

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Cron hangs: looking for quiz overdue quiz attempts

by Geoffrey Rowland -
Picture of Plugin developers

Thanks Tim

I'll give it a go and report back...

In reply to Geoffrey Rowland

Re: Cron hangs: looking for quiz overdue quiz attempts

by Geoffrey Rowland -
Picture of Plugin developers

Yes, that works well. Cron constipation is cured!

...and cron.php even gives nice Error messages identifying the orphan quizzes, so I can investigate further and clean them up.

Thanks again Tim

In reply to Tim Hunt

Re: Cron hangs: looking for quiz overdue quiz attempts

by romano gino -

Hello!

I have the same problem: Cron hangs, with this message: <!--StartFragment-->Looking for quiz overdue quiz attempts between miércoles, 31 de diciembre de 1969, 18:00 and martes, 11 de septiembre de 2012.

Right now using Moodle 2.3.1 (Build: 20120706), but I want to install Moodle 2.3.2 (Build: 20120910), but not sure if this will solve the problem.

Any suggestion?

Thanks in advanced. r.

 

In reply to romano gino

Re: Cron hangs: looking for quiz overdue quiz attempts

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Upgrading should solve the problem.

In reply to Tim Hunt

Re: Cron hangs: looking for quiz overdue quiz attempts

by Virgil Ashruf -

I'm having the same problem. The cron started two hours ago. Albeit the difference here is that this environment is running 2.5.2. The amount of quiz attempts isn't that high either, only 1756 rows in the table mdl_quiz_attempts.

Yet nothing seems to happen. The server is IIS with PHP 5.3.27 and SQLSRV as the database driver. The database is on an external server which is currently picking it's nose, regarding performance. Yet I see suspended tasks that contain either select or update statements involving any of the quiz tables.

With the hands in my hair, I'm wondering in what direction I can troubleshoot to gain an upper hand in getting this cron job running successfully.

In reply to Virgil Ashruf

Re: Cron hangs: looking for quiz overdue quiz attempts

by Virgil Ashruf -

The problem is fixed. The database got in a deadlock because the VHOST was still running and generating requests to the DB. By turning off the VHOST and churning the two suspended tasks manually via SQL I got the cron running.