What is Bleen?

"Scientists at CalTech announced today that they have discovered a new number; that new number is bleen. They claim it come between six and seven." — George Carlin

adj. - Of an object, blue when first observed before a specified time or green when first observed after that time. See also grue. — Wiktionary

In Dutch Danish, bleen means "diaper."

Debugging Memory Problems During Cron Run

Recently my cron stopped running completely and when I would manually visit mysite.com/cron.php I'd get a message like this:

Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in ...

So how do I debug this? I went to module.inc then added a bit of code to module_invoke_all();

function module_invoke_all() {
  $args = func_get_args();
  $hook = $args[0];
  unset($args[0]);
  $return = array();

  foreach (module_implements($hook) as $module) {
    $function = $module .' ' . $hook;

    // ----- Add this code ------
    if ($hook == 'cron') {
      watchdog('cron', $module . ': ' . memory_get_usage());
    }
    // --------------------------

    $result = call_user_func_array($function, $args);
    if (isset($result) && is_array($result)) {
      $return = array_merge_recursive($return, $result);
    }
    elseif (isset($result)) {
      $return[] = $result;
    }
  }
  return $return;
}

That's it. Now the next time you run your cron, take a look in your logs and you'll see exactly how much memory is being used right before (and right after) each module's hook cron. If your cron stops running in the middle, the last module to report a memory usage amount is almost certainly your culprit.

Friendly reminder: don't forget to remove this debug code once you have sorted out your memory issue.

Follow

May 19
The @mlb should have a penalty box. If you make an error you have to go to the box for 1 batter (or 2 depending on how stupid the error was)
May 17
The interwebs ... they are-a-changin: http://t.co/JWO6pviG
May 16
@djmayer7 prepare yourself ... @ColbertReport & @TheDailyShow are off for two weeks this time around
May 09
Just saw a man use a cartoonishly oversized net to capture ~20 pigeons, jump in a van and drive away. #WTF #OnlyInNY