Good day everyone,
The moodle installation uses Ubuntu 20.04 LTS, Php 7.4, MySQL 8.0, and moodle version is 3.9.6
My problem is that backup via moosh never finishes, same happens when going through the UI.
Attached is the error after performing backup.
Default exception handler: Error reading from database Debug: MySQL server has gone away
SELECT count(r.repositoryid)
FROM mdl_files f
LEFT JOIN mdl_files_reference r
ON r.id = f.referencefileid
JOIN mdl_backup_ids_temp bi
ON f.id = bi.itemid
WHERE bi.backupid = ?
AND bi.itemname = 'filefinal'
[array (
0 => '00bca615721834e0e48834155e4274a1',
)]
Error code: dmlreadexception
* line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 1624 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
* line 1697 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
* line 1907 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
* line 522 of /backup/util/dbops/backup_controller_dbops.class.php: call to moodle_database->count_records_sql()
* line 2088 of /backup/moodle2/backup_stepslib.php: call to backup_controller_dbops::backup_includes_file_references()
* line 34 of /backup/util/plan/backup_execution_step.class.php: call to backup_store_backup_file->define_execution()
* line 181 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
* line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
* line 145 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
* line 410 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
* line 95 of /home/elearnadmin/moosh/Moosh/Command/Moodle23/Course/CourseBackup.php: call to backup_controller->execute_plan()
* line 354 of /home/elearnadmin/moosh/moosh.php: call to Moosh\Command\Moodle23\Course\CourseBackup->execute()
!!! Error reading from database !!!
Debug info: MySQL server has gone away
SELECT count(r.repositoryid)
FROM mdl_files f
LEFT JOIN mdl_files_reference r
ON r.id = f.referencefileid
JOIN mdl_backup_ids_temp bi
ON f.id = bi.itemid
WHERE bi.backupid = ?
AND bi.itemname = 'filefinal'
[array (
0 => '00bca615721834e0e48834155e4274a1',
)]
Error code: dmlreadexception
Stack trace: * line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 1624 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
* line 1697 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
* line 1907 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
* line 522 of /backup/util/dbops/backup_controller_dbops.class.php: call to moodle_database->count_records_sql()
* line 2088 of /backup/moodle2/backup_stepslib.php: call to backup_controller_dbops::backup_includes_file_references()
* line 34 of /backup/util/plan/backup_execution_step.class.php: call to backup_store_backup_file->define_execution()
* line 181 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
* line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
* line 145 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
* line 410 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
* line 95 of /home/elearnadmin/moosh/Moosh/Command/Moodle23/Course/CourseBackup.php: call to backup_controller->execute_plan()
* line 354 of /home/elearnadmin/moosh/moosh.php: call to Moosh\Command\Moodle23\Course\CourseBackup->execute()
Exception ignored in shutdown function tool_log\log\manager::dispose: Error reading from database (MySQL server has gone away
SHOW VARIABLES LIKE 'max_allowed_packet'
[NULL])
Exception ignored in shutdown function tool_monitor\eventobservers::process_buffer: Error reading from database (MySQL server has gone away
SHOW VARIABLES LIKE 'max_allowed_packet'
[NULL])
Potential coding error - existing temptables found when disposing database. Must be dropped!
PHP Fatal error: Uncaught ddl_change_structure_exception: DDL sql execution error (MySQL server has gone away
DROP TEMPORARY TABLE mdl_backup_ids_temp) in /var/www/html/moodle/lib/dml/moodle_database.php:492
Stack trace:
#0 /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php(1098): moodle_database->query_end()
#1 /var/www/html/moodle/lib/ddl/database_manager.php(77): mysqli_native_moodle_database->change_database_structure()
#2 /var/www/html/moodle/lib/ddl/database_manager.php(332): database_manager->execute_sql_arr()
#3 /var/www/html/moodle/lib/dml/moodle_temptables.php(140): database_manager->drop_table()
#4 /var/www/html/moodle/lib/dml/moodle_database.php(405): moodle_temptables->dispose()
#5 /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php(622): moodle_database->dispose()
#6 /var/www/html/moodle/lib/dml/moodle_database.php(160): mysqli_native_moodle_database->dispose()
#7 [internal function]: moodle_database->__destruct()
#8 {main}
thrown in /var/www/html/moodle/lib/dml/moodle_database.php on line 492
Fatal error: Uncaught ddl_change_structure_exception: DDL sql execution error (MySQL server has gone away
DROP TEMPORARY TABLE mdl_backup_ids_temp) in /var/www/html/moodle/lib/dml/moodle_database.php:492
Stack trace:
#0 /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php(1098): moodle_database->query_end()
#1 /var/www/html/moodle/lib/ddl/database_manager.php(77): mysqli_native_moodle_database->change_database_structure()
#2 /var/www/html/moodle/lib/ddl/database_manager.php(332): database_manager->execute_sql_arr()
#3 /var/www/html/moodle/lib/dml/moodle_temptables.php(140): database_manager->drop_table()
#4 /var/www/html/moodle/lib/dml/moodle_database.php(405): moodle_temptables->dispose()
#5 /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php(622): moodle_database->dispose()
#6 /var/www/html/moodle/lib/dml/moodle_database.php(160): mysqli_native_moodle_database->dispose()
#7 [internal function]: moodle_database->__destruct()
#8 {main}
thrown in /var/www/html/moodle/lib/dml/moodle_database.php on line 492
changed max_allowed_packet to 1GB in mysql
Error still persists, next step change max_execution_time in php.ini -> https://moodle.org/mod/forum/discuss.php?d=320964
changed max_execution_time in php.ini to 1200 from 600
required apache2 service restart
Error still persists, next step change max_heap_table_size and tmp_table_size -> https://moodle.org/mod/forum/discuss.php?d=273400
SELECT @@global.max_heap_table_size;
SET PERSIST max_heap_table_size = 1024 * 1024 * 1024;
SELECT @@global.tmp_table_size;
SET PERSIST tmp_table_size = 1024 * 1024 * 1024;
Error still persists.