Skip to content

Commit

Permalink
Revert "[JENKINS-67351] Avoid deadlock when resuming Pipelines in som…
Browse files Browse the repository at this point in the history
…e cases (jenkinsci#188)"

This reverts commit 6d6de20.
  • Loading branch information
dwnusbaum committed Jan 14, 2022
1 parent 5e24327 commit a384598
Showing 1 changed file with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import hudson.Extension;
import hudson.ExtensionList;
import hudson.XmlFile;
import hudson.init.InitMilestone;
import hudson.init.Terminator;
import hudson.model.listeners.ItemListener;
import hudson.remoting.SingleLaneExecutorService;
Expand All @@ -32,7 +31,6 @@
import java.util.logging.Logger;

import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.Beta;
import org.kohsuke.accmod.restrictions.DoNotUse;

/**
Expand All @@ -46,8 +44,6 @@ public class FlowExecutionList implements Iterable<FlowExecution> {
private final SingleLaneExecutorService executor = new SingleLaneExecutorService(Timer.get());
private XmlFile configFile;

private transient volatile boolean resumptionComplete;

public FlowExecutionList() {
load();
}
Expand Down Expand Up @@ -163,18 +159,6 @@ public static FlowExecutionList get() {
return l;
}

/**
* Returns true if all executions that were present in this {@link FlowExecutionList} have been loaded and resumed.
*
* This takes place slightly after {@link InitMilestone#COMPLETED} is reached during Jenkins startup.
*
* Useful to avoid resuming Pipelines in contexts that may lead to deadlock.
*/
@Restricted(Beta.class)
public boolean isResumptionComplete() {
return resumptionComplete;
}

/**
* When Jenkins starts up and everything is loaded, be sure to proactively resurrect
* all the ongoing {@link FlowExecution}s so that they start running again.
Expand All @@ -183,12 +167,10 @@ public boolean isResumptionComplete() {
public static class ItemListenerImpl extends ItemListener {
@Override
public void onLoaded() {
FlowExecutionList list = FlowExecutionList.get();
for (final FlowExecution e : list) {
for (final FlowExecution e : FlowExecutionList.get()) {
// The call to FlowExecutionOwner.get in the implementation of iterator() is sufficent to load the Pipeline.
LOGGER.log(Level.FINE, "Eagerly loaded {0}", e);
}
list.resumptionComplete = true;
}
}

Expand Down Expand Up @@ -293,7 +275,7 @@ public void onFailure(@NonNull Throwable t) {
}
}

}, Timer.get()); // We always hold RunMap and WorkflowRun locks here, so we resume steps on a different thread to avoid potential deadlocks. See JENKINS-67351.
}, MoreExecutors.directExecutor()); // TODO: Unclear if we need to run this asynchronously or if StepExecution.onResume has any particular thread requirements.
}
}
}

0 comments on commit a384598

Please sign in to comment.