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
[FIXED JENKINS-8703] fixed a race condition in the pipe connection.
- Loading branch information
Showing
4 changed files
with
66 additions
and
3 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
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
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import hudson.remoting.PipeTest; | ||
import org.jvnet.hudson.test.Bug; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.Callable; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.Future; | ||
|
||
/** | ||
* Test bed to reproduce JENKINS-8703. | ||
* | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
public class Driver8703 { | ||
@Bug(8703) | ||
public static void main(String[] args) throws Throwable { | ||
// int i=0; | ||
// while (true) { | ||
// System.out.println(i++); | ||
// foo(); | ||
// } | ||
|
||
ExecutorService es = Executors.newCachedThreadPool(); | ||
List<Future> flist = new ArrayList<Future>(); | ||
for (int i=0; i<10000; i++) { | ||
flist.add(es.submit(new Callable<Object>() { | ||
public Object call() throws Exception { | ||
Thread.currentThread().setName("testing"); | ||
try { | ||
foo(); | ||
return null; | ||
} catch (Exception e) { | ||
throw e; | ||
} catch (Throwable t) { | ||
throw new Exception(t); | ||
} finally { | ||
Thread.currentThread().setName("done"); | ||
} | ||
} | ||
})); | ||
} | ||
|
||
for (Future ff : flist) { | ||
ff.get(); | ||
} | ||
|
||
System.out.println("All done"); | ||
es.shutdown(); | ||
} | ||
|
||
private static void foo() throws Throwable { | ||
PipeTest t = new PipeTest(); | ||
t.setName("testSaturation"); | ||
t.runBare(); | ||
} | ||
} |
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