Project

General

Profile

Bug #5426

Static memory and time limits in file create_backup.php causes problem

Added by Hubert Borderiou almost 7 years ago. Updated almost 7 years ago.

Status:
Bug resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
06/09/2012
Due date:
% Done:

100%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

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

create_backup.php (3.73 KB) create_backup.php Yoselyn Castillo, 07/09/2012 08:38

Associated revisions

Revision 26399a15 (diff)
Added by Julio Montoya almost 7 years ago

Should fix bug that blocks the course back up see #5426

Revision 77106a72 (diff)
Added by Julio Montoya almost 7 years ago

Should fix bug that blocks the course back up see #5426

Revision 421f3d2f (diff)
Added by Hubert Borderiou almost 7 years ago

Little bug in a sql request in CourseBuilder - ref #5426

History

#1

Updated by Yoselyn Castillo almost 7 years ago

  • Status changed from New to Assigned
  • Assignee set to Yoselyn Castillo
#2

Updated by Yannick Warnier almost 7 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?

#3

Updated by Yoselyn Castillo almost 7 years ago

Updload this file. It changes the way in which execution time and memory limit are setted

#4

Updated by Hubert Borderiou almost 7 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.

#5

Updated by Yannick Warnier almost 7 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 :-)

#6

Updated by Hubert Borderiou almost 7 years ago

I switch to worker mode to be able to have more simultaneaous connections, may be it was a wrong idea

#7

Updated by Julio Montoya almost 7 years ago

Did anyone tried the fix sent by Yoselyn?

#8

Updated by Julio Montoya almost 7 years ago

  • Status changed from Needs more info to Assigned
  • Assignee changed from Hubert Borderiou to Julio Montoya
#9

Updated by Julio Montoya almost 7 years ago

I found the error, it was a bad query

#10

Updated by Julio Montoya almost 7 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

#12

Updated by Yoselyn Castillo almost 7 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?

#13

Updated by Hubert Borderiou almost 7 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"

#14

Updated by Hubert Borderiou almost 7 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 !

#15

Updated by Julio Montoya almost 7 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.

#16

Updated by Julio Montoya almost 7 years ago

  • Status changed from Needs testing to Bug resolved
  • % Done changed from 80 to 100

Seems to be fixed. Closing ...

Also available in: Atom PDF