If your Drupal powered web site suddenly quits running it's cron jobs (you'll see log entries complaining that the task has taken over an hour, or cannot run cron while it's already in progress) you'll probably have a hard time trying to figure out what part of the cron job is hanging it. I know I did.
Here's how to diagnose the problem:
Inside your site's includes folder is a file called module.inc, make a copy of it, and restore this file after the problem is corrected. Now open module.inc and change the part that says:
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;
$result = call_user_func_array($function, $args);
if (isset($result) && is_array($result)) {
$return = array_merge_recursive($return, $result);
}
else if (isset($result)) {
$return[] = $result;
}
}
return $return;
}
To this code I found buried in the Drupal discussion boards:
function module_invoke_all() {
$args = func_get_args();
$hook = $args[0];