Skip to content

Commit

Permalink
[JENKINS-22249] Do not bother checking process existence if we just s…
Browse files Browse the repository at this point in the history
…tarted it.
  • Loading branch information
jglick committed Oct 10, 2014
1 parent d75ffad commit 88aed02
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -91,6 +91,7 @@ public String getScript() {
/*package*/ static final class ShellController extends FileMonitoringController {

private int pid;
private transient int exitStatusCount;

private ShellController(FilePath ws) throws IOException, InterruptedException {
super(ws);
Expand Down Expand Up @@ -123,9 +124,12 @@ private synchronized int pid(FilePath ws) throws IOException, InterruptedExcepti
if (status != null) {
return status;
}
int _pid = pid(workspace);
if (_pid > 0 && !ProcessLiveness.isAlive(workspace.getChannel(), _pid)) {
return -1; // arbitrary code to distinguish from 0 (success) and 1+ (observed failure)
// Do not bother checking this the first few times; WorkflowTest.buildShellScriptAcrossDisconnect sometimes fails otherwise, TBD why
if (exitStatusCount++ > 10) {
int _pid = pid(workspace);
if (_pid > 0 && !ProcessLiveness.isAlive(workspace.getChannel(), _pid)) {
return -1; // arbitrary code to distinguish from 0 (success) and 1+ (observed failure)
}
}
return null;
}
Expand Down

1 comment on commit 88aed02

@jglick
Copy link
Member Author

@jglick jglick commented on 88aed02 Nov 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.