Skip to content

Commit

Permalink
[FIXED JENKINS-19446]
Browse files Browse the repository at this point in the history
Defer the notification to avoid deadlock.

(cherry picked from commit a5755cb)

Conflicts:
	changelog.html
  • Loading branch information
kohsuke authored and olivergondza committed Feb 28, 2014
1 parent ef6343b commit 41baac8
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions core/src/main/java/hudson/model/AbstractItem.java
Expand Up @@ -43,6 +43,7 @@
import hudson.util.IOException2;
import hudson.util.IOUtils;
import jenkins.model.Jenkins;
import jenkins.model.Jenkins.MasterComputer;
import org.apache.tools.ant.taskdefs.Copy;
import org.apache.tools.ant.types.FileSet;
import org.kohsuke.stapler.WebMethod;
Expand Down Expand Up @@ -508,21 +509,23 @@ public synchronized void delete() throws IOException, InterruptedException {
checkPermission(DELETE);
performDelete();

try {
invokeOnDeleted();
} catch (AbstractMethodError e) {
// ignore
}

Jenkins.getInstance().rebuildDependencyGraphAsync();
}
// defer the notification to avoid the lock ordering problem. See JENKINS-19446.
MasterComputer.threadPoolForRemoting.submit(new java.util.concurrent.Callable<Void>() {
@Override
public Void call() throws Exception {
invokeOnDeleted();
Jenkins.getInstance().rebuildDependencyGraphAsync();
return null;
}

/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private void invokeOnDeleted() throws IOException {
getParent().onDeleted(this);
/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private void invokeOnDeleted() throws IOException {
getParent().onDeleted(AbstractItem.this);
}
});
}

/**
Expand Down

0 comments on commit 41baac8

Please sign in to comment.