ERROR: INSERT INTO mdl_question_attempt_steps

ERROR: INSERT INTO mdl_question_attempt_steps

by Moodle Eastern -
Number of replies: 7

Moodle Version 2.4, Win2003

We are getting this error and cannot seem to get rid of it. Unfortunately, we do not understand the Moodle schema completely to take concrete actions. It has temporarily worked when I removed some rows from mdl_question_attempt_steps but the error is back again so I need a permanent fix from someone who understands the DB schema. It looks like Moodle is trying to enter a duplicate index but w/o understanding of scehma, we are hesitant to take further actions.

The problem is probably a residue from our upgrade to 2.0 which went horribly. I read some forums but no one has good solution on how to fix it. Help please!

Debug info: Duplicate entry '9408-0' for key 'mdl_quesattestep_queseq_uix'
INSERT INTO mdl_question_attempt_steps (questionattemptid,sequencenumber,state,fraction,timecreated,userid) VALUES(?,?,?,?,?,?)
[array (
0 => 9408,
1 => 0,
2 => 'todo',
3 => NULL,
4 => 1362674639,
5 => '557',
)]

Average of ratings: -
In reply to Moodle Eastern

Re: ERROR: INSERT INTO mdl_question_attempt_steps

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

"our upgrade to 2.0 which went horribly"

That is really unspecific, which does not help us diagnose the problem.

If your site did not upgrade properly then all bets are off.

Also, you have not said at what action taken by users leads to this error message, which makes is still harder to diagnose what is going on.

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

Re: ERROR: INSERT INTO mdl_question_attempt_steps

by Keerti Rastogi -

We are also facing this same error sometimes, when a number of students start quiz attempts at the same time. We are using moodle - 2.4 on our site. Below is the screenshot of the same -

Located error

In reply to Keerti Rastogi

Re: ERROR: INSERT INTO mdl_question_attempt_steps

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 does not actually happen when the student starts their attempt. If it was, sequencenumber would be 0, and here it is 1.

This is more likely to be what happens when the student clicks next at the bottom of the first page of the quiz.

And actually, I would not be surprised if this is what happens when the get impatient and click again, rather than waiting for the overloaded server to respond.

It would be interesting to know if the problem still happens with the latest Moodle version.

In reply to Tim Hunt

Re: ERROR: INSERT INTO mdl_question_attempt_steps

by Keerti Rastogi -

Thanks Tim, for your quick reply ! We checked for the next button on the quiz page, but its automatically get disabled on one click. Still if its possible that it could post multiple requests, that could cause this duplicate entry error ? OR There could be any other reasons as well ?

In reply to Keerti Rastogi

Re: ERROR: INSERT INTO mdl_question_attempt_steps

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, the code was designed to be robust. I did try to consider these issues while developing it.

I meant to ask some questions before:

  • What database are you using? (MySQL, Postgres, ...)
  • If MySQL, which storage engine? (InnoDB, MyISAM, ...)
  • How is it installed? (Single server, Master/slave replication, master/master, ...)
In reply to Tim Hunt

Re: ERROR: INSERT INTO mdl_question_attempt_steps

by Keerti Rastogi -

We are using - MySQL database, storage engine - InnoDB and we have installation as - Master/slave, but currently there is no replication, only master is running.

In reply to Keerti Rastogi

Re: ERROR: INSERT INTO mdl_question_attempt_steps

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

MySQL + InnoDB with no replication is a good, common set-up.

Now I really want to know how this error is happening, but I cannot think what the problem might be.

Since it only happens under high load, it is going to be difficult to work it out though. If you manage to learn any more about what is happening, please tell us.