Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -
Number of replies: 16

Hello  , 

In   Site Admin > Server > Task Logs   I have many messages  like that : 

Execute adhoc task: core\task\asynchronous_copy_task
Adhoc task id: 140471
Adhoc task custom data: {"backupid":"491479acbf367fd2d1826fbbcfdb14ad","restoreid":"7861493d7e1bc4eb9c02f71293ee2ac6"}
... started 12:45:18. Current memory use 38.5 Mo.
Course copy: Processing asynchronous course copy for course id: 748
Course copy: Backing up course, id: 748
... used 31856 dbqueries
... used 14.781877994537 seconds
Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

for couride 745 , 748 , and some others 

My courses are not duplicate with the reuse course option  & copy course  

My environment is the following:

Moodle 4.5.6 (Build: 20250811) / PHP 8.3.24 / MariaDB 11.4.8-MariaDB
SSH access available for PHP commands, but no root access.

Following the reading of various posts on these forums, I also tried disabling asynchronous adhoc tasks, but whether enabled or disabled, the result seems to be the same.
I increased the following PHP parameters:
max_execution_time = 720
max_input_time = 600
max_input_vars = 250000

I can't  even duplicate Quiz 

I was impacted with https://moodle.atlassian.net/browse/MDL-83541    but now I used successfully the fix script proposed but I still can't  have the copy backup&restore process achieve with success.

any thanks for any kind of help . 

Sam

Average of ratings: -
In reply to Samuel LMB

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Ken Task -
Picture of Particularly helpful Moodlers

Since the issue appears to be about quiz, suggest installing the Health check plugin:

https://moodle.org/plugins/tool_health

One of the items checked are quizzes.   When it finishes running it presents a screen with the issues related to quizzes and provides a suggested solution if it can.

For the adhoc stuff .... go to the category of the courses having issues.   At bottom of listing of courses you might see 'Pending ... blah, blah, blah'.   Should be a trashcan icon.    Click to remove the Pending courses.

Also, async restores/backups tips say only one per user now - meaning you can only do one of those until it completes.

Do your server error logs give any clues?

'SoS', Ken

In reply to Ken Task

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -

Hello Ken 

So many thanks for having your attention  smile 

Here is Helath tool report  : 

Only multianswer and random questions should be the parent of another question
You have questions that violate this in your databse. You will need to investigate to determine how this happened.
Question categories should belong to the same context as their parent
When one question category is the parent of another, then they should both belong to the same context. This is not true for the following categories:
Child category Parent category
ID Name Context ID ID Name Context ID
1686 Ensembles de nombres 78 1667 Seconde 77
20438 JANUARY 22682 15158 CLASSNOTES 21667
20439 10_16 22682 14213 OCTOBER 21667
20899 02_28 22682 14209 top 21667
20442 QUI_TRADUCTION 22682 19183 Défaut pour GRAM&VOC 21667
20701 09_29 22682 19220 Défaut pour 2ANGL3 21667
20447 SEPTEMBER 22682 19221 CLASSNOTES 21667
20448 09_14 22682 19224 SEPTEMBER 21667
20450 CLASSNOTES 22682 19226 Défaut pour 2ANGL4 21667
20451 SEPTEMBER 22682 19227 CLASSNOTES 21667
20678 09_14 22682 19228 SEPTEMBER 21667
20847 12_12 22682 19230 Default for 2NDE9-21-22 21667
20583 02_23 22682 19292 TEST 21667
20511 03_29 22682 19287 03_21 21667
20539 0916 22682 19318 0926 21667
20527 0927b 22682 19311 0907 21667
20568 01_06 22682 19344 01_05 21667
20575 01_16 22682 19348 01_13 21667
20577 01_20 22682 19352 01_16 21667
20578 02_03 22682 19353 01_25 21667
20580 02_28 22682 19362 02_27 21667
20584 02_23 22682 19356 02_23 21667
20585 02_27 22682 19361 02_23 21667
20595 03_05 22682 19358 03_03 21667
20693 CLASSNOTES_5 22682 19375 Défaut pour 1LLCER-21-22 21667
20626 CAMBRIDGE 22682 19402 TLLCE 21667
20692 CLASSNOTES_4 22682 19401 Défaut pour TLLCER-21-22 21667
20681 SEPTEMBER 22682 19457 CLASSNOTES 21667
20682 09_08 22682 19458 SEPTEMBER 21667
20695 SEPTEMBER 22682 19460 CLASSNOTES 21667
20706 09_22 22682 19472 SEPTEMBER 21667
20708 CLASSNOTES 22682 19484 Défaut pour 2NDE 21667
20718 JUNE 22682 19485 CLASSNOTES 21667
20820 0930 22682 19496 Default for 2NDE9-21-22 21667
20826 1014 22682 19604 SEPTEMBER_NOVEMBER 21667
20859 01_09 22682 19634 JANUARY_FEBRUARY 21667
34126 01_06 29454 10243 top 17663
33992 3011 29454 10258 CLASSNOTES_1 17663
33993 0712 29454 10292 CLASSNOTES_2 17663
34032 0401 29454 10314 CLASSNOTES_3 17663
34036 04_11 29454 10350 CLASSNOTES_4 17663
34097 0930 29454 10244 Default for 2NDE9-21-22 17663
34044 05_16 29454 10412 CLASSNOTES_5 17663
34082 CLASSNOTES 29454 11037 SEPTEMBER_NOVEMBER 17663
34102 1013 29454 10416 CLASSNOTES 17663
34043 05_10 29454 10418 CLASSNOTES_5 17663
34101 1013 29454 10916 CLASSNOTES 17663
33129 12_14 29454 11090 NOVEMBER_DECEMBER 17663
33133 12_16 29454 11128 NOVEMBER_DECEMBER 17663
33177 01_25 29454 11975 JANUARY_FEBRUARY 17663
33161 NOVEMBER_DECEMBER 29454 12035 CLASSNOTES 17663
33160 1018 29454 12036 SEPTEMBER_NOVEMBER 17663
33154 11_24 29454 12047 NOVEMBER_DECEMBER 17663
33164 11_29 29454 12058 NOVEMBER_DECEMBER 17663
33167 01_03 29454 12063 JANUARY_FEBRUARY 17663
33174 01_13 29454 12090 JANVIER_FEVRIER 17663
33196 APRIL_MAY_JUNE 29454 10245 $cat1$ 17663
33194 03_22 29454 12507 FEBRUARY_MARCH 17663
33195 27_03 29454 12872 FEBRUARY_MARCH 17663
33204 06_02 29454 13590 APRIL_MAY_JUNE 17663
33895 SEPTEMBER_NOVEMBER 29454 16475 top 22676
33207 SEPTEMBER 29454 16479 CLASSNOTES 22676
33750 09_27 29454 16480 SEPTEMBER 22676
33210 CLASSNOTES 29454 16971 Défaut pour 2ANGL4 22676
33786 OCTOBER 29454 16972 CLASSNOTES 22676
33785 09_27 29454 16973 SEPTEMBER 22676
33739 classnotes (30/11) 29454 16975 Default for 2NDE9-21-22 22676
33250 0102 29454 17040 TEST 22676
33260 03_04 29454 17066 0912 22676
33261 03_04 29454 17026 03_04 22676
33262 03_07 29454 17027 03_04 22676
33298 0916 29454 17070 0926 22676
33299 0919 29454 17057 0930 22676
33286 0927b 29454 17063 0907 22676
33301 0928 29454 17069 0919 22676
33774 09_29 29454 17727 SEPTEMBER 22676
33333 01_09 29454 17115 01_05 22676
33361 01_16 29454 17119 01_13 22676
33372 03_03 29454 17168 03_01 22676
33370 02_27 29454 17166 02_23 22676
33377 03_22 29454 17171 03_10 22676
33381 05_04 29454 17177 04_28 22676
33712 CLASSNOTES_5 29454 17181 Défaut pour 1LLCER-21-22 22676
33403 3101 29454 17196 2311 22676
33454 04_04 29454 17207 0301 22676
33411 CAMBRIDGE 29454 17212 TLLCE 22676
33711 CLASSNOTES_4 29454 17211 Défaut pour TLLCER-21-22 22676
33455 05_02 29454 17200 0401 22676
33472 04_27 29454 17123 Default for 1ERE 22676
33853 NOVEMBER 29454 17093 CLASSNOTES 22676
33719 CLASSNOTES 29454 17884 Défaut pour 2NDE 22676
33496 JUNE 29454 17885 CLASSNOTES 22676
33682 02_23 29454 17899 Default for 2NDE9-21-22 22676
33685 02_28 29454 18011 SEPTEMBER_NOVEMBER 22676
33637 JANUARY_FEBRUARY 29454 18037 CLASSNOTES 22676
33680 01_20 29454 18046 JANUARY_FEBRUARY 22676
33717 APRIL_MAY_JUNE 29454 18050 CLASSNOTES 22676
33668 1018 29454 18051 SEPTEMBER_NOVEMBER 22676
33662 11_24 29454 18062 NOVEMBER_DECEMBER 22676
33672 11_29 29454 18073 NOVEMBER_DECEMBER 22676
33675 01_03 29454 18077 JANUARY_FEBRUARY 22676
33691 03_01 29454 18090 FEBRUARY_MARCH 22676
33744 06_03 29454 18085 FEBRUARY_MARCH 22676
33736 CLASSNOTES 29454 18147 SEPTEMBER_NOVEMBER 22676
33758 10_16 29454 18542 OCTOBER 22676
33761 QUI_TRADUCTION 29454 19186 Défaut pour GRAM&VOC 22676
33831 2NDE3 29454 19192 Défaut pour 2ANGL3 22676
33766 SEPTEMBER 29454 19193 CLASSNOTES 22676
33767 09_14 29454 19196 SEPTEMBER 22676
33793 10_12 29454 19207 OCTOBER 22676
33843 11_06 29454 20242 NOVEMBER 22676
33787 10_02 29454 20088 OCTOBER 22676
33789 10_05 29454 19210 10_05 22676
33841 11_09 29454 20096 NOVEMBER 22676
33862 11_30b 29454 20100 NOVEMBER 22676
33886 MARCH 29454 16476 Défaut pour 2ANGL2 22676
33920 MAY 29454 20240 2NDE2 22676
33851 12_21 29454 22667 DECEMBER 22676
33927 MAY 29454 22672 2NDE4 22676
33859 11_15 29454 22673 NOVEMBER 22676
33852 12_21 29454 22679 DECEMBER 22676
33835 12_13 29454 23024 DECEMBER 22676
33922 MAY 29454 23145 2NDE3_DECEMBER 22676
33854 11_10 29454 23221 NOVEMBER 22676
33861 12_07 29454 23229 DECEMBER 22676
33874 01_24 29454 23251 JANUARY 22676
33882 01_23b 29454 23261 JANUARY 22676
33880 01_22 29454 25128 JANUARY 22676
33884 02_07 29454 25207 FEBRUARY 22676
33899 03_24 29454 25887 MARCH 22676
33890 02_08 29454 27160 FEBRUARY 22676
33913 03_28 29454 27162 MARCH 22676
33901 02_08 29454 27445 FEBRUARY 22676
33903 02_15 29454 27447 FEBRUARY 22676
33917 04_04 29454 27449 MARCH 22676
33915 04_03 29454 27630 APRIL 22676
33919 04_04 29454 27706 APRIL 22676
33932 05_22 29454 27946 MAY 22676
33925 05_13 29454 28155 MAY 22676
33928 05_13 29454 28192 MAY 22676
33935 2109 29454 29654 2009 29359
33936 2809 29454 29653 1709 29359
33944 0701 29454 29665 0612 29359
33954 0702 29454 29675 0701 29359
33964 03_11 29454 29703 03_11 29359
33967 05_09 29454 29710 0401 29359
33983 CLASSNOTES_2 29454 29745 CLASSNOTES_3 29359
33994 CLASSNOTES_3 29454 29769 CLASSNOTES_4 29359
34018 CLASSNOTES_4 29454 29792 CLASSNOTES_5 29359
34174 27_03 29454 29896 01_06 29359
34450 0916 29454 29650 top 29359
34122 12_14 29454 29872 NOVEMBER_DECEMBER 29359
34125 12_16 29454 29875 NOVEMBER_DECEMBER 29359
34145 1018 29454 30319 1006 29359
34138 1118 29454 29923 1115 29359
34139 11_24 29454 29921 1018 29359
34144 1007 29454 29909 1006 29359
34147 1116 29454 30334 1116 29359
34148 11_29 29454 30335 11_29 29359
34157 01_13 29454 29929 JANVIER_FEVRIER 29359
34159 01_20 29454 29936 01_16 29359
34176 03_05 29454 29948 02_28 29359
34172 03_03 29454 29944 03_01 29359
34170 03_17 29454 29951 03_10 29359
34173 03_22 29454 29952 03_17 29359
34175 04_28 29454 29955 03_22 29359
34179 05_15 29454 29958 04_28 29359
34182 06_02 29454 29964 05_26 29359
34186 09_07 29454 29970 Défaut pour 2ANGL4 29359
34187 Default for Film Intro (listening comprehension) 29454 30606 top 29408
34243 06_03 29454 30128 06_01 29359
34251 05_04 29454 30048 04_28 29359
34272 3101 29454 30065 2311 29359
34323 04_04 29454 30074 0301 29359
34280 CAMBRIDGE 29454 30079 TLLCE 29359
34321 03_18 29454 30078 Défaut pour TLLCER-21-22 29359
34324 05_02 29454 30068 0401 29359
34326 05_25 29454 30145 05_16 29359
34342 05_11 29454 30143 05_11 29359
34344 05_24 29454 30377 05_22 29359
34345 05_26 29454 30126 05_25 29359
34346 SEPTEMBER 29454 29842 CLASSNOTES 29359
34351 09_22 29454 30148 SEPTEMBER 29359
34353 CLASSNOTES 29454 30154 Défaut pour 2NDE 29359
34363 JUNE 29454 30155 CLASSNOTES 29359
34433 05_16 29454 30168 Default for 2NDE9-21-22 29359
34448 1005 29454 30270 SEPTEMBER_NOVEMBER 29359
35709 NEWS 29454 32458 top 31334
35673 CLASSNOTE_TAGL245 29454 32459 Default for TAGL245 31334
35678 CLASSNOTE_TAGL245 29454 32461 CLASSNOTE_TAGL245 31334
36186 IMPACT_OF_TOURISM_READING_COMPREHENSION 29362 32462 TOURISM 31334
36183 OCTOBER 29362 32945 CLASSNOTE_TAGL245 31334
36181 09_27 29362 32946 SEPTEMBER 31334
36187 10_04 29362 34678 OCTOBER 31334
35737 REPRESENTATION 29454 34805 Défaut pour 1 AMC 31334
35745 APRIL 29454 34806 CLASSNOTES 1AMC 31334
35705 09_29 29454 34807 SEPTEMBER 31334
35711 10_20 29454 34808 OCTOBER 31334
35728 INDIA 29454 34907 GENETICS 31334
35721 TEXTS 29454 34908 GATTACA 31334
35733 11_24 29454 34809 NOVEMBER 31334
35729 SUMMARY 29454 34911 FILM 31334
35722 CRISPR 29454 34916 TEXTS 31334
35732 12_19b 29454 34810 DECEMBER 31334
35726 COMPREHENSION 29454 34918 BIRTH 31334
35736 01_16 29454 34980 JANUARY 31334
35740 02_09 29454 34984 FEBRUARY 31334
35744 03_04 29454 34987 MARCH 31334
35746 04_12 29454 34991 APRIL 31334
39629 TermSpé 29072 53 top 109
39630 Combinatoire 29072 13949 TermSpé 109

I have already run the fix script as describe there : https://moodle.org/mod/forum/discuss.php?d=469603 but nothing change for the yellow part above . 

No pending task in category course , no trashcan icon ... but  here is current tasks : 
image.png

and :  

image%20%281%29.png

and here is  Php logs of the server  : 

[02-Sep-2025 01:10:14 Europe/Paris] Default exception handler: Erreur de lecture de la base de données Debug: MySQL server has gone away
SELECT RELEASE_LOCK(?) AS unlocked
[array (
  0 => 'c753fa2490d4f7e8be5e0138817dc7142650eb53',
)]
Error code: dmlreadexception
* line 497 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 1364 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
* line 1687 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
* line 144 of /lib/classes/lock/mysql_lock_factory.php: call to moodle_database->get_record_sql()
* line 100 of /lib/classes/lock/lock.php: call to core\lock\mysql_lock_factory->release_lock()
* line 218 of /lib/classes/cron.php: call to core\lock\lock->release()
* line 125 of /lib/classes/cron.php: call to core\cron::run_scheduled_tasks()
* line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

[02-Sep-2025 01:10:14 Europe/Paris] Default exception handler: Erreur de lecture de la base de données Debug: MySQL server has gone away
SELECT RELEASE_LOCK(?) AS unlocked
[array (
  0 => 'c753fa2490d4f7e8be5e0138817dc7142650eb53',
)]
Error code: dmlreadexception
* line 497 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 1364 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
* line 1687 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
* line 144 of /lib/classes/lock/mysql_lock_factory.php: call to moodle_database->get_record_sql()
* line 100 of /lib/classes/lock/lock.php: call to core\lock\mysql_lock_factory->release_lock()
* line 218 of /lib/classes/cron.php: call to core\lock\lock->release()
* line 125 of /lib/classes/cron.php: call to core\cron::run_scheduled_tasks()
* line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function \core\task\manager::fail_running_task: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function \core\task\manager::fail_running_task: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function \core\task\manager::fail_running_task: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 01:10:14 Europe/Paris] PHP Fatal error:  Uncaught Error: Call to a member function real_escape_string() on null in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php:1231
Stack trace:
#0 /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php(1360): mysqli_native_moodle_database->emulate_bound_params()
#1 /home3/apa123/moodle.domaine.fr/lib/dml/moodle_database.php(1687): mysqli_native_moodle_database->get_records_sql()
#2 /home3/apa123/moodle.domaine.fr/lib/classes/lock/mysql_lock_factory.php(144): moodle_database->get_record_sql()
#3 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(100): core\lock\mysql_lock_factory->release_lock()
#4 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(114): core\lock\lock->release()
#5 [internal function]: core\lock\lock->__destruct()
#6 {main}
  thrown in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php on line 1231
[02-Sep-2025 01:10:14 Europe/Paris] PHP Fatal error:  Uncaught Error: Call to a member function real_escape_string() on null in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php:1231
Stack trace:
#0 /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php(1360): mysqli_native_moodle_database->emulate_bound_params()
#1 /home3/apa123/moodle.domaine.fr/lib/dml/moodle_database.php(1687): mysqli_native_moodle_database->get_records_sql()
#2 /home3/apa123/moodle.domaine.fr/lib/classes/lock/mysql_lock_factory.php(144): moodle_database->get_record_sql()
#3 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(100): core\lock\mysql_lock_factory->release_lock()
#4 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(114): core\lock\lock->release()
#5 [internal function]: core\lock\lock->__destruct()
#6 {main}
  thrown in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php on line 1231
[02-Sep-2025 01:10:14 Europe/Paris] PHP Fatal error:  Uncaught Error: Call to a member function real_escape_string() on null in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php:1231
Stack trace:
#0 /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php(1360): mysqli_native_moodle_database->emulate_bound_params()
#1 /home3/apa123/moodle.domaine.fr/lib/dml/moodle_database.php(1687): mysqli_native_moodle_database->get_records_sql()
#2 /home3/apa123/moodle.domaine.fr/lib/classes/lock/mysql_lock_factory.php(144): moodle_database->get_record_sql()
#3 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(100): core\lock\mysql_lock_factory->release_lock()
#4 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(114): core\lock\lock->release()
#5 [internal function]: core\lock\lock->__destruct()
#6 {main}
  thrown in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php on line 1231
[02-Sep-2025 02:32:24 Europe/Paris] [client 91.168.95.119]  https://moodle.lmb86.fr  Invalid Login Token:  laeticia.balkumar  Mozilla/5.0 (iPhone; CPU iPhone OS 18_6_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1
[02-Sep-2025 02:58:28 Europe/Paris] Default exception handler: Erreur de lecture de la base de données Debug: MySQL server has gone away
SELECT RELEASE_LOCK(?) AS unlocked
[array (
  0 => '226352c742ce08385ee17362adc177f154b57cba',
)]
Error code: dmlreadexception
* line 497 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 1364 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
* line 1687 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
* line 144 of /lib/classes/lock/mysql_lock_factory.php: call to moodle_database->get_record_sql()
* line 100 of /lib/classes/lock/lock.php: call to core\lock\mysql_lock_factory->release_lock()
* line 114 of /lib/classes/lock/lock.php: call to core\lock\lock->release()
* line 174 of /admin/cli/adhoc_task.php: call to core\lock\lock->__destruct()

[02-Sep-2025 02:58:28 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 02:58:28 Europe/Paris] Exception ignored in shutdown function \core\task\manager::fail_running_task: Erreur d’écriture vers la base de données
[02-Sep-2025 02:58:28 Europe/Paris] Exception ignored in shutdown function tool_log\log\manager::dispose: Erreur de lecture de la base de données
[02-Sep-2025 02:58:28 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 02:58:28 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 02:58:28 Europe/Paris] PHP Fatal error:  Uncaught Error: Call to a member function real_escape_string() on null in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php:1231
Stack trace:
#0 /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php(1360): mysqli_native_moodle_database->emulate_bound_params()
#1 /home3/apa123/moodle.domaine.fr/lib/dml/moodle_database.php(1687): mysqli_native_moodle_database->get_records_sql()
#2 /home3/apa123/moodle.domaine.fr/lib/classes/lock/mysql_lock_factory.php(144): moodle_database->get_record_sql()
#3 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(100): core\lock\mysql_lock_factory->release_lock()
#4 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(114): core\lock\lock->release()
#5 [internal function]: core\lock\lock->__destruct()
#6 {main}
  thrown in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php on line 1231
[02-Sep-2025 02:58:44 Europe/Paris] Default exception handler: Erreur de lecture de la base de données Debug: MySQL server has gone away
SELECT RELEASE_LOCK(?) AS unlocked
[array (
  0 => 'f7641223d428dc6da5167e3a50d2083038d8a7ed',
)]
Error code: dmlreadexception
* line 497 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 1364 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
* line 1687 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
* line 144 of /lib/classes/lock/mysql_lock_factory.php: call to moodle_database->get_record_sql()
* line 100 of /lib/classes/lock/lock.php: call to core\lock\mysql_lock_factory->release_lock()
* line 114 of /lib/classes/lock/lock.php: call to core\lock\lock->release()
* line 128 of /lib/classes/cron.php: call to core\lock\lock->__destruct()
* line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

[02-Sep-2025 02:58:44 Europe/Paris] Exception ignored in shutdown function \core\task\manager::fail_running_task: Erreur d’écriture vers la base de données
[02-Sep-2025 02:58:44 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 02:58:44 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 02:58:44 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 02:58:44 Europe/Paris] Exception ignored in shutdown function tool_log\log\manager::dispose: Erreur de lecture de la base de données
[02-Sep-2025 02:58:44 Europe/Paris] PHP Fatal error:  Uncaught Error: Call to a member function real_escape_string() on null in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php:1231
Stack trace:
#0 /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php(1360): mysqli_native_moodle_database->emulate_bound_params()
#1 /home3/apa123/moodle.domaine.fr/lib/dml/moodle_database.php(1687): mysqli_native_moodle_database->get_records_sql()
#2 /home3/apa123/moodle.domaine.fr/lib/classes/lock/mysql_lock_factory.php(144): moodle_database->get_record_sql()
#3 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(100): core\lock\mysql_lock_factory->release_lock()
#4 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(114): core\lock\lock->release()
#5 [internal function]: core\lock\lock->__destruct()
#6 {main}
  thrown in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php on line 1231
[02-Sep-2025 03:00:16 Europe/Paris] Default exception handler: Erreur de lecture de la base de données Debug: MySQL server has gone away
SELECT RELEASE_LOCK(?) AS unlocked
[array (
  0 => '30880866f4037d6bebe6fd991dc05bfd72f7aa29',
)]
Error code: dmlreadexception
* line 497 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 1364 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
* line 1687 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
* line 144 of /lib/classes/lock/mysql_lock_factory.php: call to moodle_database->get_record_sql()
* line 100 of /lib/classes/lock/lock.php: call to core\lock\mysql_lock_factory->release_lock()
* line 114 of /lib/classes/lock/lock.php: call to core\lock\lock->release()
* line 128 of /lib/classes/cron.php: call to core\lock\lock->__destruct()
* line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

[02-Sep-2025 03:00:16 Europe/Paris] Exception ignored in shutdown function \core\task\manager::fail_running_task: Erreur d’écriture vers la base de données
[02-Sep-2025 03:00:16 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 03:00:16 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 03:00:16 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 03:00:16 Europe/Paris] Exception ignored in shutdown function tool_log\log\manager::dispose: Erreur de lecture de la base de données
[02-Sep-2025 03:00:16 Europe/Paris] PHP Fatal error:  Uncaught Error: Call to a member function real_escape_string() on null in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php:1231
Stack trace:
#0 /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php(1360): mysqli_native_moodle_database->emulate_bound_params()
#1 /home3/apa123/moodle.domaine.fr/lib/dml/moodle_database.php(1687): mysqli_native_moodle_database->get_records_sql()
#2 /home3/apa123/moodle.domaine.fr/lib/classes/lock/mysql_lock_factory.php(144): moodle_database->get_record_sql()
#3 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(100): core\lock\mysql_lock_factory->release_lock()
#4 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(114): core\lock\lock->release()
#5 [internal function]: core\lock\lock->__destruct()
#6 {main}
  thrown in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php on line 1231
[02-Sep-2025 03:01:41 Europe/Paris] Default exception handler: Erreur de lecture de la base de données Debug: MySQL server has gone away
SELECT RELEASE_LOCK(?) AS unlocked
[array (
  0 => '14a4c164b297a791472829c67efb2482cf386493',
)]
Error code: dmlreadexception
* line 497 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
* line 1364 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
* line 1687 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
* line 144 of /lib/classes/lock/mysql_lock_factory.php: call to moodle_database->get_record_sql()
* line 100 of /lib/classes/lock/lock.php: call to core\lock\mysql_lock_factory->release_lock()
* line 114 of /lib/classes/lock/lock.php: call to core\lock\lock->release()
* line 128 of /lib/classes/cron.php: call to core\lock\lock->__destruct()
* line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

[02-Sep-2025 03:01:41 Europe/Paris] Exception ignored in shutdown function \core\task\manager::fail_running_task: Erreur d’écriture vers la base de données
[02-Sep-2025 03:01:41 Europe/Paris] Exception ignored in shutdown function tool_log\log\manager::dispose: Erreur de lecture de la base de données
[02-Sep-2025 03:01:41 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 03:01:41 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 03:01:41 Europe/Paris] Exception ignored in shutdown function core\lock\mysql_lock_factory::auto_release: Erreur de lecture de la base de données
[02-Sep-2025 03:01:41 Europe/Paris] PHP Fatal error:  Uncaught Error: Call to a member function real_escape_string() on null in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php:1231
Stack trace:
#0 /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php(1360): mysqli_native_moodle_database->emulate_bound_params()
#1 /home3/apa123/moodle.domaine.fr/lib/dml/moodle_database.php(1687): mysqli_native_moodle_database->get_records_sql()
#2 /home3/apa123/moodle.domaine.fr/lib/classes/lock/mysql_lock_factory.php(144): moodle_database->get_record_sql()
#3 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(100): core\lock\mysql_lock_factory->release_lock()
#4 /home3/apa123/moodle.domaine.fr/lib/classes/lock/lock.php(114): core\lock\lock->release()
#5 [internal function]: core\lock\lock->__destruct()
#6 {main}
  thrown in /home3/apa123/moodle.domaine.fr/lib/dml/mysqli_native_moodle_database.php on line 1231

In french forum some people said to uncheck async and it solves their issue ... but not for me  sad 
image%20%283%29.png

What do you think and what do you suggest ?   

Many thanks 

Sam

In reply to Samuel LMB

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Ken Task -
Picture of Particularly helpful Moodlers

Appears we are involved in prep for upcoming new semester which is usually a busy time for moodle servers.  Teachers/admins doing things not normally done throughout the year.

Investigate 'context ID' ... many quizzes look to be from a couple of courses.   Find the course and investigate the quiz banks for those courses.

reference in php error logs to a moodle.domaine.fr instance of a Moodle. Is that obscured for security purposes?
Do you have multiple instances of moodle on that one server?

deletions of modules in courses

Set recyclebin time to retain for 1 second to hurry along deletions to trash.

Set recyclebin link to show all the time in course menu so with troubled courses that have deleted modules you can investigate.

PHP logs
MySQL server has gone away
Indicates the need to tweak some DB settings upward.
Is DB server localhost?

Suggest installing mysltuner.pl and run with superuser creds for the DB server. Pay attention to:
Performance metrics (information on memory) as well as InnoDB metrics (InnoDB buffer pool / data size)

'SoS', Ken

In reply to Ken Task

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -

Hello Ken ,
Many thanksfor your answer.
-->Appears we are involved in prep for upcoming new semester which is usually a busy time for moodle servers : As far as today , I am the only one who is working on it because our students and teachers comes back massively tomorrow...
--> Investigate 'context ID' ... many quizzes look to be from a couple of courses. Find the course and investigate the quiz banks for those courses : many courses have
--> reference in php error logs to a moodle.domaine.fr instance of a Moodle. Is that obscured for security purposes? : yes not to put the real name ... but if you think it can be useful to let the full real name/lines , I can do it as so desesperate I am clin d’œil ....
--> Do you have multiple instances of moodle on that one server? : only 2 the production one , and the pre-production one build last week to help in investigation and making some test. The preprod one was build the help of my web server provider ... I deleted from the log above the logs of the preprod instance .
--> according to your suggestion here is now the recycle bin parameters : 

image.png

-->  Indicates the need to tweak some DB settings upward. Is DB server localhost? : here is my conf.php  

<?php // Moodle configuration file unset($CFG); global $CFG; $CFG = new stdClass(); $CFG->dbtype = 'mariadb'; $CFG->dblibrary = 'native'; $CFG->dbhost = 'localhost'; $CFG->dbname = 'usrsrv_mood506'; $CFG->dbuser = 'usrsrv_mood506'; $CFG->dbpass = 'thepassword'; $CFG->prefix = 'mdlzn_'; $CFG->dboptions = array ( 'dbpersist' => 0, 'dbport' => '', 'dbsocket' => '', 'dbcollation' => 'utf8mb4_unicode_ci', ); $CFG->wwwroot = 'https://moodle.domaine.fr'; $CFG->dataroot = '/home/usrsrv/moodledata'; $CFG->admin = 'admin'; $CFG->directorypermissions = 0777; $CFG->preventexecpath = true; $CFG->forced_plugin_settings['backup'] = []; $CFG->forced_plugin_settings['restore'] = []; require_once(__DIR__ . '/lib/setup.php');

So DB server seems local...

--> Suggest installing mysltuner.pl and run with superuser creds for the DB server. Pay attention to: Performance metrics (information on memory) as well as InnoDB metrics (InnoDB buffer pool / data size)  :  not sure i can install and execute it , I am not a superadmin/root user of the server  ( I think I am in a jail environnement )

Hope all of this help again. 

Questions : 

After running the fix script( cleanup_duplicates_context_cli_global_dp_parent_fix.php) , I ended up with many questions labeled duplicate1, duplicate2, etc., as well as numerous duplicate question categories, some of which also come from other parent categories or even from other courses within the course context.
I haven’t found a way to bulk delete these questions and categories.

so questions are :

  1. Is there a plugin, or alternatively, what SQL query should be run in PhpMyAdmin to delete all the questions whose names contain duplicateN within the given course context? What are the risks?

  2. How can I bulk delete several categories at once in Question Bank > Categories?

Thanks

Sam

In reply to Samuel LMB

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Ken Task -
Picture of Particularly helpful Moodlers

A finely tuned DB server is key to experience/performance of moodle.   So with 2 instances of moodle even if one is not used as much as the other, would mean tweaking is needed for DB performance.

If you can't install, someone can ... contact that person and ask they install and run MySQLTuner.pl.   + make whatever tweaks for changes to config of DB server it recommends ... in the areas mentioned previously.

Do that first before seeking bulk ... cause those will fail if DB isn't performing as it should.   And in your situation, that's the last thing you need at present!

'SoS', Ken

In reply to Samuel LMB

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Ken Task -
Picture of Particularly helpful Moodlers

The Health check does not show what course.  So ...

make a query of the mdl_question table for
id, parent, name, createdby where name like '%somethinginnameofquz% to get info on what user.

createdby is the user id - example shows 2075

Query of mdl_users:
select username from mdl_user where id = 2075;

Then investigate that users profile to see what courses and thus quizzes via GUI.

'SoS', Ken

In reply to Ken Task

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -
It's easy ... the user is me smile . I know exactly what course .. and I suppose it is because of the many duplicateN questions and duplicate categories ...
In reply to Samuel LMB

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Ken Task -
Picture of Particularly helpful Moodlers

I don't know what you mean by some postings!!!

It appears you are admin of the moodle or you wouldn't be able to change recyclebin settings.

And the courses with issues are yours ... are there other teachers/courses in the system?

Again, looking for bulk that doesn't exist in the GUI could be performed via backend or cli mysql client access IF .... IF ... one knows exactly what they are doing and the ramifications those actions might have on the entire question bank for all teachers!

I'll say it again ... get mysqltuner.pl installed and run.  Tweak settings.

'SoS', Ken

In reply to Ken Task

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -
I am the Admin AND i am a Math teacher .. and yes we are many teachers of a Lycee in France ( 800 students from 15 to 19 years old ) . Some of my courses and colleagues courses have issues with many duplicate questions quiz and categories .

here is the result of mysqltuner.pl :
>> MySQLTuner 2.7.0
* Jean-Marie Renouard * Major Hayden >> Bug reports, feature requests, and downloads at http://mysqltuner.pl/
>> Run with '--help' for additional options and output filtering

ℹ Skipped version check for MySQLTuner script
✔ Logged in using credentials passed on the command line
✘ Failed to execute: SHOW REPLICA STATUS\G
✘ FAIL Execute SQL / return code: 256
✘ Failed to execute: SHOW SLAVE STATUS\G
✘ FAIL Execute SQL / return code: 256
✔ Operating on 64-bit architecture

-------- Storage Engine Statistics --------------------------------------------- --------------------
ℹ Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +S EQUENCE
ℹ Data in InnoDB tables: 5.9G (Tables: 561)
✔ Total fragmented tables: 0

✔ Currently running supported MySQL version 11.4.8

-------- Log file Recommendations ---------------------------------------------- --------------------
✘ Log file /speed/mysql/error_serv.log doesn't exist

-------- Analysis Performance Metrics ------------------------------------------ --------------------
ℹ innodb_stats_on_metadata: OFF
✔ No stat updates during querying INFORMATION_SCHEMA.

-------- Views Metrics --------------------------------------------------------- --------------------

-------- Triggers Metrics ------------------------------------------------------ --------------------

-------- Routines Metrics ------------------------------------------------------ --------------------

-------- Security Recommendations ---------------------------------------------- --------------------
ℹ MariaDB Server - 11.4.8
ℹ Skipped due to unsupported feature for MySQL 8.0+

-------- CVE Security Recommendations ------------------------------------------ --------------------
ℹ Skipped due to --cvefile option undefined

-------- Performance Metrics --------------------------------------------------- --------------------
ℹ Up for: 2d 12h 5m 32s (358M q [1K qps], 1M conn, TX: 3142G, RX: 75G)
ℹ Reads / Writes: 93% / 7%
ℹ Binary logging is disabled
ℹ Physical Memory : 125.3G
ℹ Max MySQL memory : 42.9G
ℹ Other process memory: 0B
ℹ Total buffers: 11.3G global + 16.2M per thread (2000 max threads)
ℹ Performance_schema Max memory usage: 0B
ℹ Galera GCache Max memory usage: 0B
✔ Maximum reached memory usage: 13.9G (11.12% of installed RAM)
✔ Maximum possible memory usage: 42.9G (34.28% of installed RAM)
✔ Overall possible memory usage with other process is compatible with memory av ailable
✔ Slow queries: 0% (151/358M)
✔ Highest usage of available connections: 8% (168/2000)
✔ Aborted connections: 0.03% (333/1082888)
✘ Name resolution is active: a reverse name resolution is made for each new con nection which can reduce performance
✔ Query cache is disabled by default due to mutex contention on multiprocessor machines.
✔ Sorts requiring temporary tables: 0% (403 temp sorts / 36M sorts)
✘ Joins performed without indexes: 3482675
✔ Temporary tables created on disk: 19% (5M on disk / 25M total)
✔ Thread cache hit rate: 99% (259 created / 1M connections)
✔ Table cache hit rate: 99% (369M hits / 369M requests)
✔ table_definition_cache (729088) is greater than number of tables (646)
✔ Open file limit used: 0% (20K/9M)
✔ Table locks acquired immediately: 99% (53M immediate / 53M locks)

-------- Performance schema ---------------------------------------------------- --------------------
✘ Performance_schema should be activated.
ℹ Sys schema is not installed.

-------- ThreadPool Metrics ---------------------------------------------------- --------------------
ℹ ThreadPool stat is disabled.

-------- MyISAM Metrics -------------------------------------------------------- --------------------
ℹ General MyIsam metrics:
ℹ +-- Total MyISAM Tables : 0
ℹ +-- Total MyISAM indexes : 0B
ℹ +-- KB Size :1.0G
ℹ +-- KB Used Size :315.4M
ℹ +-- KB used :30.8%
ℹ +-- Read KB hit rate: 100.0% (1B cached / 142K reads)
ℹ +-- Write KB hit rate: 78.5% (2M cached / 2M writes)
ℹ No MyISAM table(s) detected ....

-------- InnoDB Metrics -------------------------------------------------------- --------------------
ℹ InnoDB is enabled.
✔ InnoDB File per table is activated
✔ InnoDB Buffer Pool size ( 8.0G ) under limit for 64 bits architecture: (17179 869184.0G )
✔ InnoDB buffer pool / data size: 8.0G / 5.9G
✔ Ratio InnoDB log file size / InnoDB Buffer pool size: 2.0G * 1/8.0G should be equal to 25%
✘ Cannot calculate InnoDB Buffer Pool Chunk breakdown due to missing or zero va lues:
ℹ - innodb_buffer_pool_size: 8589934592
ℹ - innodb_buffer_pool_chunk_size: 0
ℹ - innodb_buffer_pool_instances: 1
✔ InnoDB Read buffer efficiency: 99.87% (12173784774 hits / 12189155224 total)
✔ InnoDB Write Log efficiency: 92.92% (303142748 hits / 326236065 total)
✔ InnoDB log waits: 0.00% (0 waits / 23093317 writes)

-------- Aria Metrics ---------------------------------------------------------- --------------------
ℹ Aria Storage Engine is enabled.
✔ Aria pagecache size / total Aria indexes: 2.0G/0B
✔ Aria pagecache hit rate: 99.5% (70M cached / 376K reads)

-------- TokuDB Metrics -------------------------------------------------------- --------------------
ℹ TokuDB is disabled.

-------- XtraDB Metrics -------------------------------------------------------- --------------------
ℹ XtraDB is disabled.

-------- Galera Metrics -------------------------------------------------------- --------------------
ℹ Galera is disabled.

-------- Replication Metrics --------------------------------------------------- --------------------
ℹ Galera Synchronous replication: NO
ℹ No replication slave(s) for this server.
ℹ Binlog format: MIXED
ℹ XA support enabled: ON
ℹ Semi synchronous replication Master: OFF
ℹ Semi synchronous replication Slave: OFF
ℹ This is a standalone server

-------- Recommendations ------------------------------------------------------- --------------------
General recommendations:
Configure your accounts with ip or subnets only, then update your configurat ion with skip-name-resolve=ON
We will suggest raising the 'join_buffer_size' until JOINs not using indexes are found.
See https://dev.mysql.com/doc/refman/8.0/en/server-system-variables .html#sysvar_join_buffer_size
Performance schema should be activated for better diagnostics
Consider installing Sys schema from https://github.com/FromDual/mariadb-sys for MariaDB
Before changing innodb_log_file_size and/or innodb_log_files_in_group read t his: https://bit.ly/2TcGgtU
Variables to adjust:
skip-name-resolve=ON
join_buffer_size (> 4.0M, or always use indexes with JOINs)
performance_schema=ON


thanks and sorry for my bad english wink
Sam
In reply to Samuel LMB

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Ken Task -
Picture of Particularly helpful Moodlers

A previous posting by you that showed logs indicated a client using a smart phone ... was that you attempting admin stuff?

Performance_schema should be activated.
ℹ Sys schema is not installed.

performance_schema=ON

 InnoDB buffer pool / data size: 8.0G / 5.9G
innodb_buffer_pool_instances: 1
Should be 8 ... 1 per buffer pool?

https://releem.com/docs/mysql-performance-tuning/innodb_buffer_pool_instances

innodb_buffer_pool_instances
Considerations
The reason to break the InnoDB buffer pool into instances is straightforward. By dividing the buffer pool, concurrency is improved so there is less contention between threads. Every instance takes an equal section of the buffer pool, so if innodb_buffer_pool_size is set to 8GB and innodb_buffer_pool_instances is set to 4, then each instance is 2GB. Ideally, each instance should be a minimum of 1GB in size. 

In code/admin/cli/ run the following ...
adhoc_task.php
fix_orphaned_question_categories.php
check_database_schema.php
checks.php with -v

Am guessing, but appears you are getting ready for fall semester and your process with courses is to restore a no-user course backup for the new courses?
The course restores that failed ... are those the same courses that have quiz issues?

Instead, make one backup of a course and archive - that's the records retention archive.  You could do that from command line (backup.php in code/admin/cli) for all courses saving to a directory outside of moodledata/filedir/


Then, use course reset - removing all students their work leaving only teachers and content.

That will avoid quiz bank duplication.

'SoS', Ken

In reply to Ken Task

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -

--> A previous posting by you that showed logs indicated a client using a smart phone ... was that you attempting admin stuff? :  Hum it was not me ..  I search the log above and it was a student connection  as user ... sorry for the "noise" in the log 

--> ℹ Sys schema is not installed.  : Should I copy your post to my web server provider and ask him for installation  ??? 

--> Result of the commands : 

$ php adhoc_task.php --execute
Server Time: Tue, 02 Sep 2025 21:30:33 +0200

Ran 0 adhoc tasks found at Tue, 02 Sep 2025 21:30:33 +0200

$ php fix_orphaned_question_categories.php
== Checking for orphaned categories ==
No orphaned question categories found.

$php check_database_schema.php
-------------------------------------------------------------------------------
format_tiles_tile_options
 * column 'optiontype' should be NOT NULL (I)
 * column 'elementid' should be NOT NULL (I)
-------------------------------------------------------------------------------

 php checks.php -v
CRITICAL: Délai max d’échec de tâche (tool_task_maxfaildelay)
   Statut | Vérifier
----------+--------------------------------------------------------------------
       OK | Environnement (core_environment)
          |     Votre environnement serveur possède les modules requis.
          |     https://moodle.website.fr/admin/environment.php
          |
       OK | Mise à jour (core_upgradecheck)
          |     Aucune mise à jour nécessaire pour la version installée
          |     4.5.6 (Build: 20250811) (2024100706). C’était quand même
          |     sympa de venir !
          |     https://moodle.website.fr/admin/index.php?cache=1
          |
       NA | Antivirus (core_antivirus)
          |     Aucun scanner antivirus n’est activé actuellement
          |     https://moodle.website.fr/admin/settings.php?section=manageantiviruses
          |
       OK | Lancement du cron (tool_task_cronrunning)
          |     Le cron est lancé fréquemment
          |     https://moodle.website.fr/admin/tool/task/runningtasks.php
          |
    ERROR | Délai max d’échec de tâche (tool_task_maxfaildelay)
          |     5 tâche(s) en erreur
          |     https://moodle.website.fr/admin/tasklogs.php
          |
    ERROR | File d’attente des tâches ad hoc (tool_task_adhocqueue)
          |     La plus ancienne tâche non traitée a 6 jours 4 heures, ce
          |     qui dépasse 4 heures
          |     https://moodle.website.fr/admin/tool/task/adhoctasks.php
          |
  WARNING | Tâches de longue durée (tool_task_longrunningtasks)
          |     Tâches de longue durée : 4
          |     https://moodle.website.fr/admin/tool/task/runningtasks.php
          |

--> Am guessing, but appears you are getting ready for fall semester and your process with courses is to restore a no-user course backup for the new courses? The course restores that failed ... are those the same courses that have quiz issues?  : Yes absolutely .. but some courses that was not change after the January update of moodle still well works for copy course   BUT NOT for duplicate quiz !  Any quiz of any course does not have a duplicate successful operation  sad  

--> I can save courses ... with or without questions bank ... but for many courses if questions bank present the restore fails .   The only solution I have found for the moment is saving courses without question  banks and then I can restore it as a new course BUT I lost every quiz and questions   sad    so many many hours of work for my colleague and me !!!!  

Sam 

In reply to Samuel LMB

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Ken Task -
Picture of Particularly helpful Moodlers

    ERROR | File d’attente des tâches ad hoc (tool_task_adhocqueue)
          |     La plus ancienne tâche non traitée a 6 jours 4 heures, ce
          |     qui dépasse 4 heures

The oldest unprocessed task is 6 days 4 hours old, which is
| more than 4 hours old

I'd say you could truncate mdl_adhoc_task due to above.  That table is a 'tracker' ... anything that couldn't be done via cron job is put into that table to execute or try to execute later.   Obviously, those aren't working.

All may not be lost ... depends.
Make a query of you DB thusly:

select contenthash,filename,filesize,timecreated,timemodified from mdl_files where filename like '%.mbz';

Those are course backups.
Filename should have shortname of the course and course id and a date/time stamp in them.
If you see a troubled course in that listing, the backup might be old, but the quiz banks might be ok.

Now the trick would be to extract a copy of that file ... which is the contenthash value seen in the query, out to an area by the filename seen in the query where you could use that file
to restore - and the only way to do that is to have a filesystem repository (fsr) created just for these restores.  At the beginning of a restore process one could choose the fsr as the source of the backup file.

And if you step through each screen of the restore, there is a screen that would allow exclusion of users.

I'd pick only one course with above and try it out first before doing others.

Fingers crossed!

'SoS', Ken

In reply to Ken Task

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Ken Task -
Picture of Particularly helpful Moodlers

Follow up ...

Please see: https://docs.moodle.org/500/en/Course_restore

Are you trying to restore the backups as a new course? or are you replacing a course?

And please do respond to the PM I sent you in PM!

'SoS', Ken

In reply to Ken Task

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -

Hi Ken 

Sorry for the delay ( we are not in the same world time zone .. ) 
I answer your PM quickly this morning before the " student return's rush"  ... 

I sent you the result of the SQL request you recommand  :  select contenthash,filename,filesize,timecreated,timemodified from mdl_files where filename like '%.mbz';

and to answer your question below :  

ach time, duplication is intended to create a new course that is largely identical for each of my new student groups, but that I can occasionally adapt according to the specific needs of each group.
The quizzes are then adjusted for each group at the time of assessment, but they share a common question bank. This question bank grows every year with new questions based on the specific situations encountered by each group.

Actually, I think I should be using Moodle’s metacourses, but I don’t have the specific knowledge required to make proper use of this feature, which to me is not clearly or sufficiently documented.

In reply to Ken Task

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -
I detect at the moment that I can delete some Drag-and-Drop Matching questions :
image.png
 
I have this error message : 
image%20%281%29.png
 
Sam
In reply to Samuel LMB

Adhoc task failed: core\task\asynchronous_copy_task,Attempt to assign property "subquestions" on false

by Samuel LMB -
Sorry it is not I CAN delete .... but i CAN'T