Skip to content

Commit

Permalink
[FIXED JENKINS-34939] Hold the lock on this folder only while deletin…
Browse files Browse the repository at this point in the history
…g itself, not its children.
  • Loading branch information
jglick committed May 19, 2016
1 parent 721fc6e commit 7b13295
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -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())) {
Expand All @@ -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
Expand Down

0 comments on commit 7b13295

Please sign in to comment.