Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WorkflowRun.execution must be set before the execution starts.
Otherwise Owner.get can throw an error claiming that the build has not started yet.
We do need to null out the field if starting fails, but we can do that subsequently.
Amends the fix of JENKINS-29221 in #149, which introduced this race condition.
Originally-Committed-As: 99ca243654430737de5f3be6367c9b24ccfdf5bb
  • Loading branch information
jglick committed Aug 5, 2015
1 parent 913943e commit 682638d
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -184,13 +184,11 @@ public WorkflowRun(WorkflowJob job, File dir) throws IOException {
newExecution.addListener(new GraphL());
completed = new AtomicBoolean();
logsToCopy = new LinkedHashMap<String,Long>();
newExecution.start();

// It's only okay to initialise the global once the new FlowExecution
// has successfully started.
execution = newExecution;
newExecution.start();
executionPromise.set(newExecution);
} catch (Throwable x) {
execution = null; // ensures isInProgress returns false
finish(Result.FAILURE, x);
executionPromise.setException(x);
return;
Expand Down

0 comments on commit 682638d

Please sign in to comment.