Topic: Database restore failed without any notice or error messages

After a month using FA 2.3.3 without any serious problems, one day database restore failed without any notice or error messages, just a yellow triangle icon with exclamation mark showed.

When I checked the database, only tables starting from stock_category until wo_requirements exist. Table from areas until sql_trails didn't exist.

At first I suspected that it was because the backup file was too big (actually it was only 355KB in gzip). So I tested to restore smaller backup file (10 KB in gzip). But I got similar problem.

Is there any idea how I can trace what cause this problem?

Re: Database restore failed without any notice or error messages

You can simply try to unpack the dump script and try to restore it via phpmyadmin Import function. If this would fail fortunatelly you see more error messages.
Janusz

Re: Database restore failed without any notice or error messages

Hi Janusz,

Thanks for your reply. I tried to import via phpmyadmin, and the data was imported successfully. I traced the code, and found that the restore execution stopped when processing sql_trails table. Since the execution found an error, then the code tried to rollback any changes done (dropping and creating tables), but somehow the rollback process was failed. So, what's left was table from stock_category until wo_requirements (they were untouched by restore process).

My guess is that since the sql_trails table related to $sql_trail variable, $sql_trail set to 1 could be the cause of this problem. So I set $sql_trail to 0, and the problem is gone. So when we restore the backup, we have to set $sql_trail to 0.

Now I found another problem. The restore process is successfully done, but the warning icon still shows, and the icon shows even when the restore process isn't finished. I suspect the setting of tout variable in utils.js is related to this problem. Can you help to explain how the tout variable works?

Albert

Re: Database restore failed without any notice or error messages

Hi, I see you have found the problem. Thanks for the info, the fix will be included in next minor FA release.

Regarding timeout problem I'm not sure where it can be sourced. Maybe you have to change max_execution_time in php.ini file to some bigger value? In fact timeout triangle displayed means that communication has been broken during ajax call, so the exact reason can vary from just big net latency to server constraints on php script execution time.
Janusz

5 (edited by apprayo 05/30/2011 04:14:14 pm)

Re: Database restore failed without any notice or error messages

Hi Janusz,

Just like what you said, after some experiments, this afternoon I found that the triangle is shown when the ajax call got its timeout, even the background restore process is still running actually (neglecting the ajax timeout). And I can fix this by adding more time for ajax execution.
I edit this line of code from js/utils.js (line 38)

tout = tout | 6000;    // default timeout value

to

tout = tout | 600000;    // default timeout value

I'm not sure what 6000 means (whether it means seconds or microseconds and why it is bit wise OR operatored). I just make the "6000" bigger by adding two zeroes there. And it works. The success message will be shown right after the restore process finished.

Albert

Re: Database restore failed without any notice or error messages

Frankly, I don't know why there is a bitwise OR here - certainly it should be '||', anyway it roughly works the same. The timeout value is stated in miliseconds here, so 6s is default for fast ajax updates. If the timeout on default value is reached frequently, something wrong is in between browser and server, most probably this is just the time for hosting change.

Keep in mind, that for time consuming operation (e.g. backup restore) timeout value of 60000ms is set in insert.js (about line 246), and progress bar is displayed in this case (instead of turning arrows). We can evenually enlarge this value abowe 60s, but AFAIR the javascript library used in FA accepts only 2-byte integer values for timeout, so maximum seems to be 64s.

Janusz

Re: Database restore failed without any notice or error messages

With my current settings:
- $sql_trail set to 0
- "tout = tout | 600000;" in utils.js
- no change in inserts.js
I restored my backup file of size 3.948MB (unzipped) or 355KB (gzipped) in about 3 minutes and 20 seconds.

This is of course beyond the 60s limit in inserts.js like you just explained. Everything was normal, no timeout, no triangle icon, the proper "Restore backup completed." message was shown.

I haven't traced the whole js code, but from this experience I think the timeout limit is in utils.js. I haven't checked what effect I will get if I edit the timeout value in inserts.js.

Albert

Re: Database restore failed without any notice or error messages

Ok, thank you for investigating the problem. I will check the code again and will try to fix this in next minor release.
Janusz

Re: Database restore failed without any notice or error messages

Thanks Janusz.