-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
3.11.16
-
None
-
MOODLE_311_STABLE
Hello,
I would like to suggest an improvement for the Grading View, and that is disabling the Ajax background call whenever a teacher has the same grading page opened multiple times, and only keep the call active for the page where a teacher is actively grading.
I'm referring to this call:
s3_svr 10.0.0.100 (X.X.X.X) - [14/Sep/2023:22:30:02 +0000] "POST /mod/assign/feedback/editpdf/ajax.php HTTP/1.1" 200 47 "mod/assign/view.php?id=123456&rownum=0&action=grader&userid=56789" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
e2_svr 10.0.0.100 (X.X.X.X) - [14/Sep/2023:22:30:02 +0000] "POST /mod/assign/feedback/editpdf/ajax.php HTTP/1.1" 200 47 "mod/assign/view.php?id=123456&rownum=0&action=grader&userid=56789" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
Why? Because we've experienced database deadlocks because of it.
We run a cluster of 3 servers and we had a situation where a teacher had the grading page opened multiple times, causing about 20 Ajax calls to the same resource, which lead to multiple deadlocks, and in a particular case it triggered an internal MariaDB Galera crash, which simply disabled that node from the cluster.
s3_svr php_fpm[3456441]: Default exception handler: Error writing to database Debug: Deadlock found when trying to get lock; try restarting transaction
s3_svr php_fpm[3456441]: DELETE FROM mdl_assignfeedback_editpdf_annot WHERE gradeid = ? AND pageno = ? AND draft = ?
s3_svr php_fpm[3456441]: [array (
s3_svr php_fpm[3456441]: 0 => '123456',
s3_svr php_fpm[3456441]: 1 => 3,
s3_svr php_fpm[3456441]: 2 => 1,
s3_svr php_fpm[3456441]: )]
s3_svr php_fpm[3456441]: Error code: dmlwriteexception
s3_svr php_fpm[3456441]: * line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
s3_svr php_fpm[3456441]: * line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
s3_svr php_fpm[3456441]: * line 1686 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
s3_svr php_fpm[3456441]: * line 2024 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->delete_records_select()
s3_svr php_fpm[3456441]: * line 163 of /mod/assign/feedback/editpdf/classes/page_editor.php: call to moodle_database->delete_records()
s3_svr php_fpm[3456441]: * line 168 of /mod/assign/feedback/editpdf/ajax.php: call to assignfeedback_editpdf\page_editor::set_annotations()
And subsequently, led to the crash of the MariaDB Galera node, with internal error 1213:
mariadbd[1276]: 2023-09-14 22:30:05 2 [ERROR] Slave SQL: Could not execute Write_rows_v1 event on table mdl_assignfeedback_editpdf_annot; Deadlock found when trying to get lock; try restarting transaction, Error_code: 1213; the event's master log FIRST, end_log_pos 402, Internal MariaDB error code: 1213
mariadbd[1276]: 2023-09-14 22:30:05 2 [Warning] WSREP: Event 3 Write_rows_v1 apply failed: 149, seqno 217349854
(And from there, the local database got disabled, and Moodle was issuing HTTP 404 instead of HTTP 500, but for that I'll open a separate ticket).
Thanks,
A.