-
Bug
-
Resolution: Fixed
-
Minor
-
4.1.6
I think this is something not addressed on MDL-78580.
Context
Moodle 4.1.6 (Build: 20231009), with MDL-78580 included.
MySQL 5.7
Execution of every adhoc task quiz_statistics\task\recalculate
Problem
We can see this kind of errors on every run of the adhoc task:
Execute adhoc task: quiz_statistics\task\recalculate
Adhoc task id: 18149902
Adhoc task custom data:
... started 09:02:16. Current memory use 47.2 MB.
Re-calculating statistics for quiz Qüestionari Termo Tema 1 (99498) from course 23-24 TERMODINÀMICA I HIDRÀULICA (118824) (98715) with 37 attempts, start time 10/10/23, 09:02:16 ...
... used 796 dbqueries
... used 81.458127975464 seconds
Adhoc task failed: quiz_statistics\task\recalculate,S'ha produït un error en escriure a la base de dades. (Deadlock found when trying to get lock; try restarting transaction
DELETE FROM mdl_question_response_count WHERE analysisid IN (
SELECT id
FROM mdl_question_response_analysis
WHERE hashcode= ? AND whichtries = ? AND questionid = ?
)
[array (
0 => '1c744dc827c01f5b9c472805aa25d2381a1ea7e0',
1 => 'alltries',
2 => '24480951',
)])
Debug info:
Deadlock found when trying to get lock; try restarting transaction
DELETE FROM mdl_question_response_count WHERE analysisid IN (
SELECT id
FROM mdl_question_response_analysis
WHERE hashcode= ? AND whichtries = ? AND questionid = ?
)
[array (
0 => '1c744dc827c01f5b9c472805aa25d2381a1ea7e0',
1 => 'alltries',
2 => '24480951',
)]
Backtrace:
- line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
- line 1703 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
- line 216 of /question/classes/statistics/responses/analysis_for_question.php: call to mysqli_native_moodle_database->delete_records_select()
- line 140 of /question/classes/statistics/responses/analyser.php: call to core_question\statistics\responses\analysis_for_question->cache()
- line 803 of /mod/quiz/report/statistics/report.php: call to core_question\statistics\responses\analyser->calculate()
- line 774 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->analyse_responses_for_questions()
- line 721 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->analyse_responses_for_all_questions_and_subquestions()
- line 1003 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->get_all_stats_and_analysis()
- line 94 of /mod/quiz/report/statistics/classes/task/recalculate.php: call to quiz_statistics_report->calculate_questions_stats_for_question_bank()
- line 367 of /lib/cronlib.php: call to quiz_statistics\task\recalculate->execute()
- line 198 of /lib/cronlib.php: call to cron_run_inner_adhoc_task()
- line 76 of /lib/cronlib.php: call to cron_run_adhoc_tasks()
- line 178 of /admin/cli/cron.php: call to cron_run()
What is it expected?
No error and normal execution.
Related information
- https://dev.mysql.com/doc/refman/5.7/en/innodb-deadlock-example.html about example of the error message about the deadlock.