Course Restore Hangs Moodle 3.9

Course Restore Hangs Moodle 3.9

by gary Collins -
Number of replies: 15

Hello,

We have recently upgraded from Moodle 3.7 to Moodle 3.9.  

When our instructors back up a course and go to restore it, the restore hangs at 99.43%


File Restore Size is a little over 500mb.



Server: AWS Ec2 Instance
ServerOS: Ubuntu 18.04
PHP: 7.2
MySql: 8.0.22

I have set the PHP limits to;
upload_max_filesize=700M
memory_limit=900M post_max_size=700M

I have also set the value of the post_max_size=0 (that didn't seem to work)
I had also followed this post and did all the items Ken had suggested Moodle in English: Course restore stuck?
We are able to backup/restore courses that are smaller, that is why I was digging into the php limits.  I also checked into MySql Max allowed packets
they seem to be ok:


Kinda stuck and was looking for some help/suggestions.


Thanks,


Gary

Average of ratings: -
In reply to gary Collins

Re: Course Restore Hangs Moodle 3.9

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Are you *sure* it's hung? The user interface might have but it doesn't mean that it's still going in the background and the course magically appears some time later.

If you have access to the command line, you could try restoring the course using Moosh (https://moosh-online.com/). Then you can see somewhat better what's going on. If you have not done so already, switch on Debugging
In reply to Howard Miller

Re: Course Restore Hangs Moodle 3.9

by gary Collins -
Hey Howard!

Thanks for taking the time to reply.. To answer your question it does do a partial restore but no data:

I do have debugging on, I have found no information as of yet.  I will try the command line and will report back.

Thank you!


In reply to Howard Miller

Re: Course Restore Hangs Moodle 3.9

by gary Collins -
Hey Howard, I followed the install instructions and getting moosh command not found. I dont want to compound my issues and take my troubleshooting time away to troubleshoot a troubleshooting app lol. Make Sense?

Since, I have removed all plugins that did not have current version for moodle 3.9 and still have same results.
In reply to gary Collins

Re: Course Restore Hangs Moodle 3.9

by Ken Task -
Picture of Particularly helpful Moodlers

The issue with moosh is probably a matter of setting up an alias for moosh.php script so you can type/use just 'moosh'.

That aside, however, appearing to hang, but there is a course shell restored ... or screen shot suggest that's the case ... I see 'weeks' with a link to turn down each week.    Looks like Collapsed Topics addon as turning down weeks/or topics is not part of core code.

So do you have Collapsed Topics addon installed?

Also, the very last thing a restore would do is to cleanup /moodledata/temp/backup/[somecontenthashdirectorybylettersandnumbers]/

Do you have any directories in /moodledata/temp/backup/ with long names?   If so what's in them?

Ownerships/permissions on /moodledata/temp/ are rwx (globale all) recursively?

There is also a scheduled task to clean up ... by chance is that executing at a time where the restore process is getting romped upon?

'SoS', Ken

In reply to Ken Task

Re: Course Restore Hangs Moodle 3.9

by gary Collins -
Hello Ken!

Thanks also for taking the time to offer some help.  I am not 100% if Collapsed Topic addon was installed (it may have been at one point).  I did not see it in the plugins.

Ken Here is something that may help? I changed the theme to Boost. It still stopped, but I did get more information:

Exception - Call to undefined function lti_get_instance_type()

More information about this error

×Debug info:

Error code: generalexceptionmessage

×Stack trace:

line 224 of /mod/lti/service/gradebookservices/backup/moodle2/restore_ltiservice_gradebookservices_subplugin.class.php: Error thrown

line 103 of /backup/moodle2/restore_subplugin.class.php: call to restore_ltiservice_gradebookservices_subplugin->after_restore_lti()

line 445 of /backup/util/plan/restore_structure_step.class.php: call to restore_subplugin->launch_after_restore_methods()

line 106 of /backup/util/plan/restore_task.class.php: call to restore_structure_step->launch_after_restore_methods()

line 205 of /backup/util/plan/restore_plan.class.php: call to restore_task->execute_after_restore()

line 135 of /backup/moodle2/restore_final_task.class.php: call to restore_plan->execute_after_restore()

line 818 of /backup/moodle2/restore_stepslib.php: call to restore_final_task->launch_execute_after_restore()

line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_execute_after_restore->define_execution()

line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()

line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()

line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()

line 385 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()

line 219 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()

line 143 of /backup/restore.php: call to restore_ui->execute()

 

Here are the files that are in the temp/Backup




Here are the permissions for the folders





In reply to gary Collins

Re: Course Restore Hangs Moodle 3.9

by Ken Task -
Picture of Particularly helpful Moodlers

Your site must have multiple folks restoring courses ... or backing them up!

In moodledata/temp/backup/ successfull restores leave only a 0 byte .log file.   Any log file larger than 0 bytes has some info in it that might be worth a gander ... IF you can tell what restore attempt is associated with the log file.

Do you have automated backups turned on and running?

Anything/everything in moodledata/temp/backup/ can be manually erased via command line, but if you do that when another admin or autobackups or something else is making a backup that will be disrupted.

Debug shows a hint:

restore_ltiservice_gradebookservices_subplugin

So does this problem course backup have an LTI resource in it?

Is this course still viewable in site?   If so, make another backup but this time de-select any LTI resource contained therein.   Then try to restore that backup.   When doing this, change the name of the backup file slightly by adding a -nlti- in it's name so you know that backup contains no LTI resources/links in it.

'SoS', Ken

In reply to Ken Task

Re: Course Restore Hangs Moodle 3.9

by gary Collins -
Hello Ken,

If I do Exactly this...

"make another backup but this time de-select any LTI resource contained therein. Then try to restore that backup. When doing this, change the name of the backup file slightly by adding a -nlti- in it's name so you know that backup contains no LTI resources/links in it."

It restores with no issue.
In reply to gary Collins

Re: Course Restore Hangs Moodle 3.9

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

So the error is:

Exception - Call to undefined function lti_get_instance_type()

and the line at the top of the stack trace is:

line 224 of /mod/lti/service/gradebookservices/backup/moodle2/restore_ltiservice_gradebookservices_subplugin.class.php: Error thrown

On the above line of that file there is the call as expected to the function the error says is missing:

224                     if ($tool = lti_get_instance_type($instance)) {

Line 29 of the same file loads the file containing this function:

 29 require_once($CFG->dirroot.'/mod/lti/locallib.php');

And as expected this function is defined in that file, mod/lti/locallib.php:

 512 function lti_get_instance_type(object $instance) : ?object {

Is the file mod/lti/locallib.php present on your Moodle server and does it contain the above line?

In reply to Leon Stringer

Re: Course Restore Hangs Moodle 3.9

by gary Collins -
Hey Leon,

No that is not found in the file.
In reply to gary Collins

Re: Course Restore Hangs Moodle 3.9

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

That indicates that mod/lti/locallib.php isn't the correct version for Moodle 3.9. Function lti_get_instance_type() wasn't present in Moodle 3.7 so maybe it's still the old file.

So you should ensure this file is the correct one for your Moodle version. But if one file is wrong there may be others too so I'd recommend ensuring all the Moodle source code files are correct, following steps such as:

  1. Move the current files and folders from the Moodle source code folder (the site's home directory) into a backup folder.
  2. Download and extract the latest Moodle 3.9 files into the source code folder.
  3. Copy config.php from the backup folder into the Moodle source code folder along with any additional plugins and themes you have.
When you log in you may be prompted to confirm the update as the latest source code may be newer.
In reply to Leon Stringer

Re: Course Restore Hangs Moodle 3.9

by gary Collins -
Hey Leon,

That was it. I renamed my moodle to moodle.old, moved files over from git, copied config.php, I got an upgrade message when I logged in, but it was done in a blink of an eye. It worked when I restored.

On a side note, this site was updated from 3.1 to 3.2 to 3.7 and finally to 3.9. So many chances for something to get messed up!

THANK YOU everyone for all your help!!! I hope this helps someone who is in my shoes.

Gary
In reply to gary Collins

Re: Course Restore Hangs Moodle 3.9

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
Howard will probably be of more help. However, you might also want to check your max_execution_time. I have mine set at 900, but you might try something much larger, like 1200.

I am not a MySQL expert, but I do see that you are using MySQL 8. I forget if that version is support, but you can check.
In reply to Rick Jerz

Re: Course Restore Hangs Moodle 3.9

by gary Collins -
Hey Rick,

Max_execute_time is set to 900. As for the MySQL I am good there..

In reply to Rick Jerz

Re: Course Restore Hangs Moodle 3.9

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
As far as I know, restore is one of those operations that extends the time so I don't think it matters much.