Quiz throws database error

Re: Quiz throws database error

by Ken Task -
Number of replies: 2
Picture of Particularly helpful Moodlers

The 'MySQL Server has gone away' is generally a result of max_allowed_packet setting being to low ... 512M not enough.   Increase value times 2.   That's a guess.  You've not said how much memory server has so ...

Suggest installing MySQLTuner on development server first

https://github.com/major/MySQLTuner-perl

and run it to see what other tweaks DB server might benefit from.

'spirit of sharing', Ken


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

Re: Quiz throws database error

by Alan Streeter -

Thanks for responding!

Our application server has 10 Gb memory, and the database server has 8 Gb memory.

I ran mysqltuner.pl on the server, so we have some recommendations from that to look at. I'm not sure any of that would affect this one quiz though.

After bumping max_allowed_packet up to 1024M, it threw a new error when I tried to take the quiz again:


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

Warning: mysqli::query(): Error reading result set's header in /srv/www/lms.kvcc.edu/public/moodle34-2017111304.08/lib/dml/mysqli_native_moodle_database.php on line 729
Table "question_attempt_steps" does not exist
Debug info:
Error code: ddltablenotexist
Stack trace:

    line 1359 of /lib/dml/mysqli_native_moodle_database.php: dml_exception thrown
    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 349 of /mod/quiz/locallib.php: call to question_engine::save_questions_usage_by_activity()
    line 2387 of /mod/quiz/locallib.php: call to quiz_attempt_save_started()
    line 111 of /mod/quiz/startattempt.php: call to quiz_prepare_and_start_new_attempt()

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()

In reply to Alan Streeter

Re: Quiz throws database error

by Mabry Wilkinson -

I work with Alan and wanted to provide some follow up to our error. The error seems to stem from some of the Moodle code. In our config.php there is a variable "$CFG->prefix='mdl_' along with other variables necessary for the database to accept calls such as "dbuser" and "dbname" etc. While following our trace stack it appears that the error thrown, at least for the write error, is not getting that prefix appended for our db table name (question_attempt_steps). I believe that is why it is saying "Table does not exist." This issue is an interesting one as we are not running into this issue anywhere else.