Bug #5426
Static memory and time limits in file create_backup.php causes problem
Description
HI,
in file coursecopy/create_backup.php
there are some (I guess old) php.ini modification for backup// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', '256M');
ini_set('max_execution_time', 1800);
}
It may causes issue if these values are bellow the php.ini one
Is it a good thing to do to allow application to modify for a task the php.ini config ?
These values are subjective.
If we do that, may be we should check that it will not reduce the server values.
Any advice welcome.
Files
Associated revisions
Should fix bug that blocks the course back up see #5426
Little bug in a sql request in CourseBuilder - ref #5426
History
Updated by Yoselyn Castillo over 8 years ago
- Status changed from New to Assigned
- Assignee set to Yoselyn Castillo
Updated by Yannick Warnier over 8 years ago
I put these limits in place a long time ago (when Dok*** was still being used only for little courses).
The modifications are only allowed if the function ini_set() is authorized from the php.ini file (there is a configuration setting that allows for the prohibition of execution of some dangerous functions).
However, you are right that we should first check whether these values are not already higher in the PHP configuration (it used to only be necessary to have much lower values anyway).
Checking the time limit is easy, because it is a pure number (
if (ini_get('max_execution_time')<1800) { ini_set('max_execution_time',1800);}).
However, the memory_limit is a bit more tricky, because depending on the last letter, it should get multiplied by 1024, 1024*1024 or 1024*1024*1024 in order to compare it properly with the new value. Not impossible however... just a little bit more complicated.
I've been reported errors for taking a course backup on other 1.9 portals, so I guess we should try to improve this.
I suppose you've got no problem doing that, Yoselyn, right?
Updated by Yoselyn Castillo over 8 years ago
- File create_backup.php create_backup.php added
- Assignee changed from Yoselyn Castillo to Julio Montoya
Updload this file. It changes the way in which execution time and memory limit are setted
Updated by Hubert Borderiou over 8 years ago
In my 1.9 portals it takes really lots of time to create a backup.
The execution of function build() can take more than 3 minutes for a empty course but only since I've modified my Apache server to work in worker mode (instead of prefork mode).
I think I should have done something wrong in my Apache worker configuration, but I didn't find where for the moment. Any advice welcome.
Updated by Yannick Warnier over 8 years ago
- Status changed from Assigned to Needs more info
- Assignee changed from Julio Montoya to Hubert Borderiou
Hubert, I think everything is bound to work more slowly in worker mode. I don't remember the details, but I think worker ha the objective of making stuff work as threads and PHP does not support threads... so unless you use php-fpm in the background instead of apache2-mod-php, you're screwed :-)
Any reason in particular why you decided to move to worker? Better results in any way?
Backups should really be faster in 1.9. Did you install the igbinary module from PECL? There's a hack in Chamilo 1.9 to benefit from igbinary (better serialization) but it only works if you've got igbinary installed (and I think it can only be done with re-compilation or PECL module installation). Speaking of which I should really install it as well :-)
Updated by Hubert Borderiou over 8 years ago
I switch to worker mode to be able to have more simultaneaous connections, may be it was a wrong idea
Updated by Julio Montoya over 8 years ago
- Status changed from Needs more info to Assigned
- Assignee changed from Hubert Borderiou to Julio Montoya
Updated by Julio Montoya over 8 years ago
- Status changed from Assigned to Needs testing
- Assignee changed from Julio Montoya to Yoselyn Castillo
- % Done changed from 0 to 50
Requires testing
Updated by Yoselyn Castillo over 8 years ago
- Assignee changed from Yoselyn Castillo to Julio Montoya
it works fine now. Not so long time taken, but did you already send the fix in execution time and memory_limit i have done?
Updated by Hubert Borderiou over 8 years ago
Hi,
I've got error
"DATABASE ERROR #1064:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
QUERY :
SELECT * FROM `bdd`.`c_quiz_answer` WHERE c_id = 81 AND question_id =
FILE :
/home/chamilo/www/chamilo/main/coursecopy/classes/CourseBuilder.class.php
LINE :
487
CLASS :
CourseBuilder
METHOD :
build_quiz_questions"
Updated by Hubert Borderiou over 8 years ago
Just a little bug.
Fixed inhttp://code.google.com/p/chamilo/source/detail?r=e1de92c6a627f55d645631c400b09345deab3238&name=1.9.x&repo=classic
Anyway, thansk a lot guys (and girls) it works great now !
Updated by Julio Montoya over 8 years ago
- Assignee deleted (
Julio Montoya) - % Done changed from 50 to 80
Yoselyn Castillo wrote:
it works fine now. Not so long time taken, but did you already send the fix in execution time and memory_limit i have done?
I think that the problem was in the query, I didn't applied that fix. Everything seems fine right now.
Updated by Julio Montoya over 8 years ago
- Status changed from Needs testing to Bug resolved
- % Done changed from 80 to 100
Seems to be fixed. Closing ...
Should fix bug that blocks the course back up see #5426