Quiz goes to error page

Quiz goes to error page

by Alan Streeter -
Number of replies: 2

An instructor created a quiz, and when you try to take the quiz it goes to an error page. I did a backup of the course on the production Moodle and recovered it on our development Moodle to test. It gives a different error page on the development one. This quiz is only one multiple choice question, the only quiz having this issue, and it happens regardless of user. The error page with debugging information and version information is below.


OS: Ubuntu 17.10

Web serverApache/2.4.27

Database: MySQL 5.7.20

PHP: 7.1.8

Moodle: 3.4.4+ (production) and 3.4 (development)


Warning: mysqli::query(): MySQL server has gone away in /srv/www/public.com/public/moodle34-2017111304.08/lib/dml/mysqli_native_moodle_database.php on line 1327

Warning: mysqli::query(): Error reading result set's header in /srv/www/public.com/public/moodle34-2017111304.08/lib/dml/mysqli_native_moodle_database.php on line 1327

Error writing to database
Debug info: MySQL server has gone away
INSERT INTO mdl_question_attempt_steps (questionattemptid,sequencenumber,state,fraction,timecreated,userid) VALUES(?,?,?,?,?,?)
[array (
0 => 14134347,
1 => 0,
2 => 'todo',
3 => NULL,
4 => 1537983288,
5 => '2',
)]
Error code: dmlwriteexception
Stack trace:
  • line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1329 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1375 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 227 of /question/engine/datalib.php: call to mysqli_native_moodle_database->insert_record()
  • line 148 of /question/engine/datalib.php: call to question_engine_data_mapper->insert_question_attempt_step()
  • line 100 of /question/engine/datalib.php: call to question_engine_data_mapper->insert_question_attempt()
  • line 100 of /question/engine/lib.php: call to question_engine_data_mapper->insert_questions_usage_by_activity()
  • line 120 of /question/preview.php: call to question_engine::save_questions_usage_by_activity()
Error reading from database
Debug info: MySQL server has gone away
SELECT * FROM mdl_course_categories WHERE id = ?
[array (
0 => '1',
)]
Error code: dmlreadexception
Stack trace:
  • line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 1245 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1571 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
  • line 1543 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
  • line 1522 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
  • line 1868 of /lib/pagelib.php: call to moodle_database->get_record()
  • line 1856 of /lib/pagelib.php: call to moodle_page->load_category()
  • line 1888 of /lib/pagelib.php: call to moodle_page->ensure_category_loaded()
  • line 472 of /lib/pagelib.php: call to moodle_page->ensure_categories_loaded()
  • line 820 of /lib/pagelib.php: call to moodle_page->magic_get_categories()
  • line 1644 of /lib/pagelib.php: call to moodle_page->__get()
  • line 1552 of /lib/pagelib.php: call to moodle_page->resolve_theme()
  • line 1844 of /lib/setuplib.php: call to moodle_page->initialise_theme_and_output()
  • line 374 of /lib/setuplib.php: call to bootstrap_renderer->__call()
  • line ? of unknownfile: call to default_exception_handler()

Average of ratings: -
In reply to Alan Streeter

Re: Quiz goes to error page

by Ken Task -
Picture of Particularly helpful Moodlers

Typically and in the past, any "MySQL server has gone away" issue has been solved by tweaking max_allowed_packet setting in MySQL.

Reference:

https://dev.mysql.com/doc/refman/5.7/en/packet-too-large.html

Default for the variable is 16M and it needs to be increased in my.cnf for server.   Can't give you a number but doubling to 32M seems to have solved such issues on servers I admin.

After adding the line to my.cnf, DB server must be restarted to take affect.

Comment: have never heard of this being a factor for a 1 question quiz.  You might have other issues with Quiz and it might be a good idea to do a 'health' check ...

https://yourserver/admin/tool/health/

That typically finds issues the test banks/quizzes and provides recommended  solutions - which are sql statements ... so to run them it must be done from the mysql> prompt or similar.

'spirit of sharing'. Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Quiz goes to error page

by Alan Streeter -

Thank you for the response. It's been awhile, but I'm finally getting back to this issue.

Our max_allowed_packet is set to 512M.

Our max_execution_time is set to 600.

We're getting the same error when attempting to duplicate the quiz as we do when attempting to take the quiz.

It seems we don't have the option to do a health check. Is there another way to check the quiz to see if there are any underlying problems?