protected synchronized void markUnresponsiveTasks ( ) throws IOException { long now = System . currentTimeMillis ( ) ; for ( TaskInProgress tip : runningTasks . values ( ) ) { if ( tip . getRunState ( ) == TaskStatus . State . RUNNING || tip . getRunState ( ) == TaskStatus . State . COMMIT_PENDING || tip . isCleaningup ( ) ) { // Check the per-job timeout interval for tasks; // an interval of '0' implies it is never timed-out long jobTaskTimeout = tip . getTaskTimeout ( ) ; if ( jobTaskTimeout == 0 ) { continue ; } // Check if the task has not reported progress for a // time-period greater than the configured time-out long timeSinceLastReport = now - tip . getLastProgressReport ( ) ; if ( timeSinceLastReport > jobTaskTimeout && ! tip . wasKilled ) { String msg = "Task " + tip . getTask ( ) . getTaskID ( ) + " failed to report status for " + ( timeSinceLastReport / 1000 ) + " seconds. Killing!" ; LOG . info ( tip . getTask ( ) . getTaskID ( ) + ": " + msg ) ; ReflectionUtils . logThreadInfo ( LOG , "lost task" , 30 ) ; tip . reportDiagnosticInfo ( msg ) ; myInstrumentation . timedoutTask ( tip . getTask ( ) . getTaskID ( ) ) ; purgeTask ( tip , true ) ; } } } }
Kill any tasks that have not reported progress in the last X seconds .