Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Reproduced the problem. Workspace is getting released prematurely, before publishers run. This has all sorts of serious problems.
- Loading branch information
Showing
1 changed file
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,11 @@ import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; | |
import com.gargoylesoftware.htmlunit.HttpMethod; | ||
import com.gargoylesoftware.htmlunit.WebRequestSettings | ||
import com.gargoylesoftware.htmlunit.html.HtmlPage; | ||
import hudson.security.*; | ||
import hudson.tasks.BuildTrigger; | ||
import hudson.security.* | ||
import hudson.tasks.BuildStepMonitor; | ||
import hudson.tasks.BuildTrigger | ||
import hudson.tasks.Publisher | ||
import hudson.tasks.Recorder; | ||
import hudson.tasks.Shell; | ||
import hudson.scm.NullSCM; | ||
import hudson.Launcher; | ||
|
@@ -47,13 +50,16 @@ import org.acegisecurity.context.SecurityContext; | |
import org.acegisecurity.context.SecurityContextHolder; | ||
import org.jvnet.hudson.test.HudsonTestCase | ||
import org.jvnet.hudson.test.Bug; | ||
import org.jvnet.hudson.test.MemoryAssert; | ||
import org.jvnet.hudson.test.MemoryAssert | ||
import org.jvnet.hudson.test.SequenceLock; | ||
import org.jvnet.hudson.test.recipes.PresetData; | ||
import org.jvnet.hudson.test.recipes.PresetData.DataSet | ||
import org.apache.commons.io.FileUtils; | ||
import java.lang.ref.WeakReference | ||
|
||
import org.jvnet.hudson.test.MockFolder; | ||
import org.jvnet.hudson.test.MockFolder | ||
|
||
import java.util.concurrent.Phaser; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jglick
Member
|
||
|
||
/** | ||
* @author Kohsuke Kawaguchi | ||
|
@@ -483,4 +489,45 @@ public class AbstractProjectTest extends HudsonTestCase { | |
def t = j.triggers()[1] | ||
assert t == newTrigger | ||
} | ||
|
||
@Bug(10615) | ||
public void testWorkspaceLock() { | ||
def p = createFreeStyleProject() | ||
p.concurrentBuild = true; | ||
def e1 = new OneShotEvent(), e2=new OneShotEvent() | ||
def done = new OneShotEvent() | ||
|
||
p.publishersList.add(new Recorder() { | ||
BuildStepMonitor getRequiredMonitorService() { | ||
return BuildStepMonitor.NONE; | ||
} | ||
|
||
@Override | ||
boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { | ||
if (build.number==1) { | ||
e1.signal(); // signal that build #1 is in publisher | ||
} else { | ||
assert build.number==2; | ||
e2.signal() | ||
} | ||
|
||
done.block() | ||
|
||
return true; | ||
} | ||
private Object writeReplace() { return new Object(); } | ||
}) | ||
|
||
def b1 = p.scheduleBuild2(0) | ||
e1.block() | ||
|
||
def b2 = p.scheduleBuild2(0) | ||
e2.block() | ||
|
||
// at this point both builds are in the publisher, so we verify that | ||
// the workspace are differently allocated | ||
assert b1.startCondition.get().workspace!=b2.startCondition.get().workspace | ||
|
||
done.signal() | ||
} | ||
} |
1 comment
on commit 61cf2df
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails often.
@kohsuke java.util.concurrent.Phaser was added in JDK 1.7, I think the builds are failing for that. As far I can see, this class isn't being used, and we can delete the import to solve the problem.