dmlwriteexception when trying to release Assignment grades to gradebook

dmlwriteexception when trying to release Assignment grades to gradebook

by Peter Ruthven-Stuart -
Number of replies: 0
Picture of Plugin developers

Hello,

I have been trying to release the grades of an assignment to the Gradebook using the Workflow feature; i.e. going from 'Not marked' to 'Released'. Every time, I get the following error:

Debug info: Deadlock found when trying to get lock; try restarting transaction
UPDATE mdl_grade_items SET needsupdate = ? WHERE (itemtype='course' OR id=?) AND courseid=?
[array (
0 => 1,
1 => '10981',
2 => '402',
)]
Error code: dmlwriteexception
Stack trace:

    line 482 of /lib/dml/moodle_database.php: dml_write_exception thrown
    line 1559 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
    line 928 of /lib/grade/grade_item.php: call to mysqli_native_moodle_database->set_field_select()
    line 1289 of /lib/gradelib.php: call to grade_item->force_regrading()
    line 2014 of /lib/grade/grade_item.php: call to grade_regrade_final_grades()
    line 284 of /lib/gradelib.php: call to grade_item->update_raw_grade()
    line 1290 of /mod/assign/lib.php: call to grade_update()
    line 1332 of /mod/assign/lib.php: call to assign_grade_item_update()
    line 7515 of /mod/assign/locallib.php: call to assign_update_grades()
    line 464 of /mod/assign/locallib.php: call to assign->process_set_batch_marking_workflow_state()
    line 55 of /mod/assign/view.php: call to assign->view()

Every time I try to change the Workflow status, 4 or 5 students get updated, and then the error above appears.

Our IT person has increased 'max_allowed_packet' from 4 MB to 16 MB as advised here, but to no avail.

A colleague of mine has also been getting a similar error (dmlwriteexception) when trying to upload grades to an Assignment in another course. Note that the Gradebooks in both courses have a very similar structure.

Note that this error only appears when attempting to release the grades to the Gradebook or trying to upload grades to an assignment. For example, going from 'Not marked' to 'Ready for release' works as expected.

In the past, when uploading grades to an assignment we were getting dmlwriteexception errors because there was an error in an equation used in the Gradebook. This is not the case now, because we are not using equations in the Gradebook.

Any advice would be greatly appreciated.

Moodle Environment:

300+ users in the two problem courses
Moodle version: 3.2.2
MySQL: 5.5.43
PHP: 5.6.7

Average of ratings: -