Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34854

Restore Causing Deadlock in Moodle 2.3.1



    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • 2.3.1
    • None
    • Backup, Database SQL/XMLDB
    • None


      I have upgraded Moodle from 2.2.1+ to 2.3.1. I am using SQL Express database. I have been trying to restore a course via a back up file which has not been created with my server but in 2.3 version(Mysql server database). Each time ending up with errors in the Step 5 of restoration

      [Microsoft][SQL Server Native Client 10.0][SQL Server]New transaction is not allowed because there are other threads running in the session.

      In php error log I can see the following message

      Error Code: 1205
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Transaction (Process ID 54) was deadlocked on lock | generic waitable object resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
      UPDATE #mdl_backup_files_temp SET newcontextid = '8950',newitemid = '1355' WHERE id = '1'
      [array (
      0 => '8950',
      1 => '1355',
      2 => '1',
      Error code: dmlwriteexception
      * line 410 of \lib\dml\moodle_database.php: dml_write_exception thrown
      * line 258 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end()
      * line 365 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end()
      * line 1044 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query()
      * line 1076 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->update_record_raw()
      * line 933 of \backup\util\dbops\restore_dbops.class.php: call to sqlsrv_native_moodle_database->update_record()
      * line 222 of \backup\util\plan\restore_structure_step.class.php: call to restore_dbops::send_files_to_pool()
      * line 1138 of \backup\moodle2\restore_stepslib.php: call to restore_structure_step->add_related_files()
      * line 359 of \backup\util\plan\restore_structure_step.class.php: call to restore_section_structure_step->after_execute()
      * line 108 of \backup\util\plan\restore_structure_step.class.php: call to restore_structure_step->launch_after_execute_methods()
      * line 153 of \backup\util\plan\base_task.class.php: call to restore_structure_step->execute()
      * line 98 of \backup\moodle2\restore_section_task.class.php: call to base_task->execute()
      * line 163 of \backup\util\plan\base_plan.class.php: call to restore_section_task->execute()
      * line 157 of \backup\util\plan\restore_plan.class.php: call to base_plan->execute()
      * line 315 of \backup\controller\restore_controller.class.php: call to restore_plan->execute()
      * line 147 of \backup\util\ui\restore_ui.class.php: call to restore_controller->execute_plan()
      * line 46 of \backup\restore.php: call to restore_ui->execute()

      I can see that the course is partially created and when I tried to delete the course I got the transaction error again. Then I tried to delete the blocks manually. After that I could delete the course.


        Issue Links



              moodle.com Moodle HQ
              archanasuresh Archana Suresh
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              0 Vote for this issue
              3 Start watching this issue