Skip to content
Permalink
Browse files

[FIXED JENKINS-34939] Hold the lock on this folder only while deletin…

…g itself, not its children.
  • Loading branch information...
jglick committed May 19, 2016
1 parent 721fc6e commit 7b132953106cab243334992ff527b4bd65b08e71
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java
@@ -609,9 +609,12 @@ public void onDeleted(TopLevelItem item) throws IOException {
}

@Override
protected void performDelete() throws IOException, InterruptedException {
public void delete() throws IOException, InterruptedException {
checkPermission(DELETE);
// delete individual items first
// (disregard whether they would be deletable in isolation)
// JENKINS-34939: do not hold the monitor on this folder while deleting them
// (thus we cannot do this inside performDelete)
SecurityContext orig = ACL.impersonate(ACL.SYSTEM);
try {
for (Item i : new ArrayList<Item>(items.values())) {
@@ -627,7 +630,11 @@ protected void performDelete() throws IOException, InterruptedException {
} finally {
SecurityContextHolder.setContext(orig);
}
super.performDelete();
synchronized (this) {
performDelete();
}
getParent().onDeleted(AbstractFolder.this);
Jenkins.getInstance().rebuildDependencyGraphAsync();
}

@Override

0 comments on commit 7b13295

Please sign in to comment.
You can’t perform that action at this time.