Sometimes when I tried edit a node, I see this error:
[12-Aug-2010 18:30:59] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1048576 bytes) in /home2/mysite/public_html/site/sites/all/modules/boost/boost.module on line 2014

[13-Aug-2010 13:09:27] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 119 bytes) in /home2/mysite/public_html/site/sites/all/modules/boost/boost.module on line 2015

Any fix for that? My php memory limit is 128mb.

Thanks

CommentFileSizeAuthor
#14 boost-882568.patch999 bytesmikeytown2
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

superfedya’s picture

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /home2/mysite/public_html/site/sites/all/modules/boost/boost.module on line 3784

superfedya’s picture

mikeytown2’s picture

hmmm looking at the code on those lines, it will be hard to fix. Boost is trying to use about a megabyte of ram for array modifications according to the errors. The link you posted (XML-RPC) has nothing to do with the code in question (array manipulation). What I could do is not use batch processing; it would be a lot slower but it won't use up as much ram. I would look elsewhere, because something is using up a bunch of your ram & boost appears to be the straw that broke the camels back.

function boost_cache_kill($files, $force_flush = FALSE) {
  $hashes = array();
  $count = 0;

  if (!$files) {
    return FALSE;
  }

  // If not ignoring file removal
  // AND site is multisite and cache path matches filename
  //  OR full base url matches filename
  if (variable_get('boost_ignore_flush', 0) < 3) {
    // Calc md5 hash and set base dir
    foreach ($files as $key => $file) {
      if (!is_string($file['filename'])) {
        if (BOOST_VERBOSE >= 5) {
          watchdog('boost', 'Error in boost_cache_kill() <br />String was not given for filename: !output', array('!output' => boost_print_r($file, TRUE, TRUE)));
        }
        continue;
      }
      if (empty($file['hash'])) {
        $files[$key]['hash'] = md5($file['filename']);
      }
      if (empty($file['base_dir'])) {
        $files[$key]['base_dir'] = BOOST_FILE_PATH;
      }
      $hashes[] = $files[$key]['hash']; //LINE 2014
      if (stristr($files[$key]['filename'], BOOST_ROOT_CACHE_DIR) == FALSE) { // LINE 2015
        unset($files[$key]);
      }
    }
    // Expire entries from Database
    if (count($hashes)) {
      if ($force_flush || !BOOST_EXPIRE_NO_FLUSH) {
        boost_db_multi_update_set('boost_cache', 'expire', '%d', 0, 'hash', "'%s'", $hashes);
      }
      else {
        boost_db_multi_update_set('boost_cache', 'expire', '%d', 434966400, 'hash', "'%s'", $hashes);
        $count = db_affected_rows();
      }
    }
    // Kill Files from filesystem
    if ($force_flush || !BOOST_EXPIRE_NO_FLUSH) {
      foreach ($files as $file) {
        $filenames = boost_get_all_filenames($file['filename'], $file['base_dir']);
        foreach ($filenames as $key => $values) {
          foreach ($values as $num => $filename) {
            if (file_exists($filename)) {
              @unlink($filename);
              if ($key == 'normal' && $num == 0) {
                $count++;
              }
            }
          }
        }
      }
    }
  }
  return $count;
}
function boost_db_multi_update_set($table, $set_field, $set_placeholders, $set_value, $where_field, $where_placeholder, $data) {
  // Get the number of rows that will be inserted
  $rows = count($data);
  // Create what goes in the IN ()
  $in = $where_placeholder;
  // Add the rest of the place holders
  for ($i = 1; $i < $rows; $i++) {
    $in .= ', ' . $where_placeholder;
  }
  // Build the query
  $query = "UPDATE {" . $table . "} SET $set_field = $set_placeholders WHERE $where_field IN ($in)";
  // Add the set value to the top of the array
  array_unshift($data, $set_value); // LINE 3784
  // Run the query
  return db_query($query, $data);
}
superfedya’s picture

And this problem appears recently, before everything was OK.

[16-Aug-2010 10:15:20] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /home2/mysite/public_html/site/sites/all/modules/boost/boost.module on line 2001

mikeytown2’s picture

well it keeps choking on the boost_cache_kill function, trying to allocate small amounts of memory from what I can tell. What changed?

superfedya’s picture

What changed? My site became bigger. Installed some modules and switched to the FastCGI PHP + eAccelerator.
Modules:
Authcache
CacheRouter
Date
Organic groups

And it's happen more often, when I edit a node created by others authors.

Thanks

superfedya’s picture

Now I got this:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 526034 bytes) in /home2/mysite/public_html/site/includes/database.mysql-common.inc on line 41

mikeytown2’s picture

Like I stated before, something changed on your site and is eating up all the ram. Boost works with millions of nodes so I'm tempted to say look somewhere else for the issue...

superfedya’s picture

ok, thanks. but there is a way, to look the ram usage on shared hosting?

mikeytown2’s picture

Best bet is to setup the site local & run xdebug on it.
Guessing your using xampp so this guide should be helpful
http://unitstep.net/blog/2009/01/26/getting-xdebug-to-work-with-apachexa...

Marko B’s picture

Think this is similar / related to

http://drupal.org/node/936422#comment-3633892

Marko B’s picture

mikeytown2’s picture

created an issue with views #988680: Memory leak with $view->pre_execute() & $view->attach_displays() and looking for a work around atm.

mikeytown2’s picture

Version: 6.x-1.18 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
999 bytes
mikeytown2’s picture

Status: Needs review » Fixed

committed this change

v1p3r1c3’s picture

Hello Mikey

I got this error after applying the patch.

patch -b < boost-882568.patch
patching file boost.module
Hunk #1 FAILED at 1327.
1 out of 1 hunk FAILED -- saving rejects to file boost.module.rej

mikeytown2’s picture

patch is for the dev version of boost; and if your running the latest dev, it already has it committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.