Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
WorkflowRun.execution must be set before the execution starts.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jglick committed Aug 5, 2015
1 parent 37d485a commit 99ca243
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 99ca243

Please sign in to comment.