Funny old thing, but its because of some poor programming:
In the modules. schedulers folder there is a file called scheduler.php where they check for dead or hung processes:
They use a function with is_resource which will always return as null so it never fires, thus you never get out of the 'In Progress' status.
Change it to:
function flushDeadJobs() {
$GLOBALS['log']->debug('-----> Scheduler flushing dead jobs');
$lowerLimit = mktime(0, 0, 0, 1, 1, 2005); // jan 01, 2005, GMT-0
$now = strtotime(gmdate('Y-m-d H:i:s', strtotime('now'))); // this garbage to make sure we're getting comprable data to the DB output
$q = " SELECT s.id, s.name FROM schedulers s WHERE s.deleted=0 AND s.status = 'In Progress'";
$r = $this->db->query($q);
if($r != null) {
while($a = $this->db->fetchByAssoc($r)) {
$q2 = " SELECT st.id, st.execute_time FROM schedulers_times st
WHERE st.deleted=0
AND st.scheduler_id = '{$a['id']}'
ORDER BY st.execute_time DESC";
$r2 = $this->db->query($q2);
if($r2 != null) {
$a2 = $this->db->fetchByAssoc($r2); // we only care about the newest
if($a2 != null) {
$GLOBALS['log']->debug("-----> Scheduler found [ {$a['name']} ] 'In Progress' with most recent Execute Time at [ {$a2['execute_time']} GMT-0 ]");
$execTime = strtotime($a2['execute_time']);
if($execTime > $lowerLimit) {
if(($now - $execTime) >= (5 * $this->timeOutMins)) {
$GLOBALS['log']->info("-----> Scheduler found a dead Job. Flushing status and reseting Job");
$q3 = "UPDATE schedulers s SET s.status = 'Active' WHERE s.id = '{$a['id']}'";
$this->db->query($q3);
$GLOBALS['log']->info("-----> Scheduler setting Job Instance status to 'failed'");
$q4 = "UPDATE schedulers_times st SET st.status = 'failed' WHERE st.id = '{$a2['id']}';";
$this->db->query($q4);
} else {
$GLOBALS['log']->debug("-----> Scheduler will wait for job to complete - not past threshold of [ ".($this->timeOutMins * 60)."secs ] - timeDiff is ".($now - $execTime)." secs");
}
} else {
$GLOBALS['log']->fatal("-----> Scheduler got a bad execute time: [ {$a2['execute_time']} GMT-0 ]");
}
}
}
}
}
}
There are 3 instances of this, I tested it and it works now.
Regards,
Iain


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks