Thanks Emma. Here's the debug info.
Default exception handler: Error writing to database Debug: MySQLserver has gone away
INSERT INTO mdl_backup_controllers (backupid,operation,type,itemid,format,interactive,purpose,userid,status,execution,executiontime,checksum,controller,timecreated,timemodified) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
0 => '3526365d737fbd6706aa5d82c276c297',
1 => 'backup',
2 => 'course',
3 => '10',
4 => 'moodle2',
5 => 0,
6 => 50,
7 => '2',
8 => 700,
9 => 1,
10 => 0,
11 => '47c84436e12c33926ecb9497236fe5d3',
12 =>
Error code: dmlwriteexception
* line 410 of /lib/dml/moodle_database.php: dml_write_exception thrown
* line 1050 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 1092 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
* line 87 of /backup/util/dbops/backup_controller_dbops.class.php: call to mysqli_native_moodle_database->insert_record()
* line 333 of /backup/controller/backup_controller.class.php: call to backup_controller_dbops::save_controller()
* line 180 of /backup/controller/backup_controller.class.php: call to backup_controller->save_controller()
* line 138 of /backup/controller/backup_controller.class.php: call to backup_controller->set_status()
* line 343 of /backup/util/helper/backup_cron_helper.class.php: call to backup_controller->__construct()
* line 168 of /backup/util/helper/backup_cron_helper.class.php: call to backup_cron_automated_helper::launch_automated_backup()
* line 439 of /lib/cronlib.php: call to backup_cron_automated_helper::run_automated_backup()
* line 61 of /admin/cli/cron.php: call to cron_run()
!!! Error writing to database !!!