Restore doesn't finish the job

Re: Restore doesn't finish the job

by Eloy Lafuente (stronk7) -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Peter,

those are, really, BIG numbers!

First of all, it's necessary to check if any error is sent to the apache errors file when your browser stops. It could give us some idea about the root cause for your problem (although I'm 95% sure about it's a memory problem).

The second thing to do is to monitor your server processes (top) to see how the memory is being used by the httpd process running the restore. This could help to detect if the memory limit is reached.

About your numbers, restore loads data per module basis so, in theory, if you have 40 quizzes, it will have to handle 2.000.000/40 = 50.000 answers at the same time.

Those 50.000 answers, assuming 100 characters per answer will be 5.000.000 characters (aprox. 5MB).

The critical process here is the function used to convert such XML data to an array. I can need 100x the original size to build the structure. And it's really a slooow parse and conversion routine (specially for >1MB structures) that could be causing the timeout in your browser.

Perhaps it could be improved, sending some data to the browser (to avoid the timeouts) at some strategic points.

But first, we need to be really sure about the root cause of your problem (max memory reached, browser timeout, PHP timeout...).

Finally, if you can send me your file (privately, of course) I could do some deep tests in my servers to be able to find the exact cause and, if possible, to apply the correct solution. Anyway, it will be after Moodle 1.5 release (I'll be really busy until it).

Ciao smile