Source:
@Override public Integer exitStatus(FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { Integer status = super.exitStatus(workspace, launcher, listener); if (status != null) { LOGGER.log(Level.FINE, "found exit code {0} in {1}", new Object[] {status, controlDir}); return status; } long now = System.nanoTime(); if (lastCheck == 0) { LOGGER.log(Level.FINE, "starting check in {0}", controlDir); lastCheck = now; } else if (now > lastCheck + TimeUnit.SECONDS.toNanos(HEARTBEAT_CHECK_INTERVAL)) { lastCheck = now; long currentTimestamp = getLogFile(workspace).lastModified(); if (currentTimestamp == 0) { listener.getLogger().println("process apparently never started in " + controlDir); return recordExitStatus(workspace, -2); } else if (checkedTimestamp > 0) { if (currentTimestamp < checkedTimestamp) { listener.getLogger().println("apparent clock skew in " + controlDir); } else if (currentTimestamp < checkedTimestamp + TimeUnit.SECONDS.toMillis(HEARTBEAT_MINIMUM_DELTA)) { FilePath pidFile = pidFile(workspace); if (pidFile.exists()) { listener.getLogger().println("still have " + pidFile + " so heartbeat checks unreliable; process may or may not be alive"); } else { listener.getLogger().println("s " + controlDir); listener.getLogger().println("(JENKINS-48300: if on a laggy filesystem, consider -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=300)"); return recordExitStatus(workspace, -1); } } } else { LOGGER.log(Level.FINE, "seeing recent log file modifications in {0}", controlDir); } checkedTimestamp = currentTimestamp; } return null; }

Target:
@Override public Integer exitStatus(FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { Integer status = super.exitStatus(workspace, launcher, listener); if (status != null) { LOGGER.log(Level.FINE, "found exit code {0} in {1}", new Object[] {status, controlDir}); return status; } long now = System.nanoTime(); if (lastCheck == 0) { LOGGER.log(Level.FINE, "starting check in {0}", controlDir); lastCheck = now; } else if (now > lastCheck + TimeUnit.SECONDS.toNanos(HEARTBEAT_CHECK_INTERVAL)) { lastCheck = now; long currentTimestamp = getLogFile(workspace).lastModified(); if (currentTimestamp == 0) { listener.getLogger().println("process apparently never started in " + controlDir); return recordExitStatus(workspace, -2); } else if (checkedTimestamp > 0) { if (currentTimestamp < checkedTimestamp) { listener.getLogger().println("apparent clock skew in " + controlDir); } else if (currentTimestamp < checkedTimestamp + TimeUnit.SECONDS.toMillis(HEARTBEAT_MINIMUM_DELTA)) { FilePath pidFile = pidFile(workspace); if (pidFile.exists()) { listener.getLogger().println("still have " + pidFile + " so heartbeat checks unreliable; process may or may not be alive"); } else { listener.getLogger().println("wrapper script does not seem to be touching the log file in " + controlDir); listener.getLogger().println("(JENKINS-48300: if on a laggy filesystem, consider -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=300)"); return recordExitStatus(workspace, -1); } } } else { LOGGER.log(Level.FINE, "seeing recent log file modifications in {0}", controlDir); } checkedTimestamp = currentTimestamp; } return null; }