Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-20614

The admin/cron.php does not be finished when global search function is enabled

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • 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---");

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: