Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.9.5
-
Fix Version/s: None
-
Component/s: Global search
-
Labels:None
-
Difficulty:Easy
-
Affected Branches:MOODLE_19_STABLE
Description
Global search is good function for me and other moodlers, so I think heartly. Thanks!
--------------
> <!-StartFragment-> Delete: Your E-mail Address (database id = 510486, index id = 1090, moodle instance id = 3743)
> Delete: Your E-mail Address (database id = 510491, index id = 1091, moodle instance id = 3743)
> <br />
> <b>Fatal error</b>: Allowed memory size of 50331648 bytes exhausted (tried to allocate 44 bytes) in <b>C:\xampplite\htdocs\mech\moodle\search\Zend\Search\Lucene.php</b> on line ><b>997</b><br />
The cron process halted on my server. By the way, I had set 'memory_limit' = 500M in php.ini. 50331648 is 48M.
I checked and found the cause of this problem. I propose a solution as follows;
I also think that '48M' is too smll for executing search/delete.php in my site.
(serach/cron_php5.php)
(Debug030) means my comment.
<?php
/*
- Moodle global search engine
- This is a special externalized code for cron handling in PHP5.
- Should never be called by a php 4.3.0 implementation.
*/
// (Debug030): Add from here
// http://www.php.net/manual/ja/function.ini-get.php
function return_bytes($val) {
if (is_int($val)) return $val;
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
switch($last) { case 'g': $val *= 1024; case 'm': $val *= 1024; case 'k': $val *= 1024; }
return $val;
}
// (Debug030): Add to here
try{
// overrides php limits
$maxtimelimit = ini_get('max_execution_time');
ini_set('max_execution_time', 300);
$maxmemoryamount = ini_get('memory_limit');
// (Debug030): Comment out this line
// ini_set('memory_limit', '48M');
// (Debug030): Add from here
$temp_maxmemory = '48M';
if (return_bytes($maxmemoryamount) < return_bytes($temp_maxmemory)) {
ini_set('memory_limit', $temp_maxmemory);
}
// (Debug030): Add to here
mtrace("\n-DELETE---");
I am seeing this bug in 1.9.9. If I hide global search cron completes successfully. Here is a tail for my cron...
Starting index update (additions)...
Index size before: 1112
9 modules to search in / 20 modules found.
0 blocks to search in / 32 blocks found.
1 additional to search in.
Checking assignment module for additions.
Finished assignment.
Checking chat module for additions.
No types to add.
Finished chat.
Checking data module for additions.
Finished data.
Checking forum module for additions.