Timeout when creating or duplicating a quiz

Timeout when creating or duplicating a quiz

by Richard Lobb -
Number of replies: 4
Picture of Plugin developers

I'm having a problem with a PHP timeout whenever I attempt to create a new quiz or duplicate an existing one. I'm running Moodle 2.8.1 (Build: 20141113). The problem occurs only in one class - a largish class with 500 students.

The error message in the log is:

[Mon May 04 12:08:10.152189 2015] [:error] [pid 24216] [client 132.181.106.233:64729] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /var/www/html/moodle/cache/classes/loaders.php on line 544, referer: https://quiz.cosc.canterbury.ac.nz/course/modedit.php?add=quiz&type=&course=3§ion=9&return=0&sr=0
[Mon May 04 12:08:10.152321 2015] [:error] [pid 24216] [client 132.181.106.233:64729] Potential coding error - active database transaction detected during request shutdown:\n* line 105 of /course/modlib.php: call to moodle_database->start_delegated_transaction()\n* line 266 of /course/modedit.php: call to add_moduleinfo()\n, referer: https://quiz.cosc.canterbury.ac.nz/course/modedit.php?add=quiz&type=&course=3§ion=9&return=0&sr=0

The error is always at line 544 in loaders.php which is the line

$data = unserialize($data);

I've solved the problem for now by increasing the execution time to 120 secs; creating a new quiz now succeeds but takes around 1 minute.

I'm puzzled that the problem apparently occurs with unserialize(). What is there to be unserialized when creating a new quiz? My CodeRunner question type serializes all the student code submissions and testing results and there could be thousands of such submissions, so if the problem occurred just when duplicating a quiz that might possibly be the problem. But why would this happen when creating a new quiz? 

I have the php.ini maximum memory set to 1024MB in case that's of interest.

Can anyone cast any light on this, please?

Richard Lobb

Average of ratings: -
In reply to Richard Lobb

Re: Timeout when creating or duplicating a quiz

by Michael Ko -
I had a similar problem with quizzes taking 45 minutes - 1 hour to be added. It turned out to be a problem with the grading operations: https://moodle.org/mod/forum/discuss.php?d=276909


Might not be the same problem you have, but hope it helps

In reply to Michael Ko

Re: Timeout when creating or duplicating a quiz

by Melissa Benson -

Michael, I'm trying to follow that thread but what was your resolution to make duplicating or doing quiz operations and not having it take 45 minutes?

In reply to Melissa Benson

Re: Timeout when creating or duplicating a quiz

by Melissa Benson -

And were you running into issues when working with gradebook categories? Ex: going into a quiz and trying to assign a gradebook category to a quiz or going into grades/categories and adding a category?