提交 53a31c31 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-4220] fixed a dead lock.

While the original report is in https://cloudbees.zendesk.com/tickets/427, this fix also takes care of JENKINS-4220.
上级 584112aa
...@@ -61,6 +61,9 @@ Upcoming changes</a> ...@@ -61,6 +61,9 @@ Upcoming changes</a>
<li class=bug> <li class=bug>
Environment variable not available for Maven build/POM parsing. Environment variable not available for Maven build/POM parsing.
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-8865">issue 8865</a>) (<a href="http://issues.jenkins-ci.org/browse/JENKINS-8865">issue 8865</a>)
<li class=bug>
Fixed a dead lock in concurrent builds of the same Maven projects.
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-4220">issue 4220</a>)
<li class=rfe> <li class=rfe>
thread dump now reports all the threads from all the slaves, not just the master. thread dump now reports all the threads from all the slaves, not just the master.
<li class=bug> <li class=bug>
......
...@@ -126,6 +126,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven ...@@ -126,6 +126,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
private String mavenVersionUsed; private String mavenVersionUsed;
private transient Object notifyModuleBuildLock = new Object();
public MavenModuleSetBuild(MavenModuleSet job) throws IOException { public MavenModuleSetBuild(MavenModuleSet job) throws IOException {
super(job); super(job);
} }
...@@ -134,6 +136,12 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven ...@@ -134,6 +136,12 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
super(project, buildDir); super(project, buildDir);
} }
@Override
protected void onLoad() {
super.onLoad();
notifyModuleBuildLock = new Object();
}
/** /**
* Exposes {@code MAVEN_OPTS} to forked processes. * Exposes {@code MAVEN_OPTS} to forked processes.
* *
...@@ -457,7 +465,9 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven ...@@ -457,7 +465,9 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
// actions need to be replaced atomically especially // actions need to be replaced atomically especially
// given that two builds might complete simultaneously. // given that two builds might complete simultaneously.
synchronized(this) { // use a separate lock object since this synchronized block calls into plugins,
// which in turn can access other MavenModuleSetBuild instances, which will result in a dead lock.
synchronized(notifyModuleBuildLock) {
boolean modified = false; boolean modified = false;
List<Action> actions = getActions(); List<Action> actions = getActions();
...@@ -1318,7 +1328,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven ...@@ -1318,7 +1328,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
* Extra verbose debug switch. * Extra verbose debug switch.
*/ */
public static boolean debug = Boolean.getBoolean( "hudson.maven.debug" ); public static boolean debug = Boolean.getBoolean( "hudson.maven.debug" );
@Override @Override
public MavenModuleSet getParent() {// don't know why, but javac wants this public MavenModuleSet getParent() {// don't know why, but javac wants this
return super.getParent(); return super.getParent();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册