Error Writing to Database when Attempting a Quiz

Error Writing to Database when Attempting a Quiz

by Bonnie Dilling -
Number of replies: 1

We are using moodle 2.1 and whenever a teacher/student attempts a quiz, we receive "Error Writing to Database".  The debugging is on and this is what shows up:

Error writing to database

More information about this error

Debug info: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
INSERT INTO mdl_question_usages (contextid,component,preferredbehaviour) VALUES(?,?,?)
[array (
0 => '1172',
1 => 'mod_quiz',
2 => 'deferredfeedback',
)]
Stack trace:
  • line 396 of \lib\dml\moodle_database.php: dml_write_exception thrown
  • line 878 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 920 of \lib\dml\mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 67 of \question\engine\datalib.php: call to mysqli_native_moodle_database->insert_record()
  • line 93 of \question\engine\lib.php: call to question_engine_data_mapper->insert_questions_usage_by_activity()
  • line 198 of \mod\quiz\startattempt.php: call to question_engine::save_questions_usage_by_activity()
I have checked the module settings and the quiz and everything seems normal.  I have created my own quiz to recreate this issue and try to determine the problem and no luck.
Any help would be appreciated.
Thank you
Bonnie
Average of ratings: Useful (1)
In reply to Bonnie Dilling

Re: Error Writing to Database when Attempting a Quiz

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

This is triggered by whatever replication/logging you have set up on your database. It is not specific to the quiz. Any bit of Moodle code that uses transactions will be affected.

Ah, it looks like a MySQL bug: http://bugs.mysql.com/bug.php?id=40360. See http://moodle.org/mod/forum/discuss.php?d=164025 for a suggested work-around.