Description

If you have multiple SCMSource s on a multibranch project, for example two Git repos that both have a "master" branch (or any branch name for that matter), and one source does not exclude the conflict, then the MultiBranchProject attempts to create the branch again for each source.

Because the project for that branch already exists and has built, you end up with a bunch of dead executors because builds for these new projects get triggered.

Thread has died
java.lang.IllegalStateException: /Users/mjdetullio/jenkins/jobs/freestyle-multi/branches/master/builds/1 already existed; will not overwrite with freestyle-multi/master #1
at hudson.model.RunMap.put(RunMap.java:188)
at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176)
at hudson.model.AbstractProject.newBuild(AbstractProject.java:1019)
at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1210)
at hudson.model.AbstractProject.createExecutable(AbstractProject.java:145)
at hudson.model.Executor$1.call(Executor.java:364)
at hudson.model.Executor$1.call(Executor.java:346)
at hudson.model.Queue._withLock(Queue.java:1405)
at hudson.model.Queue.withLock(Queue.java:1270)
at hudson.model.Executor.run(Executor.java:346)

The obvious solution is to make sure your includes/excludes are properly defined. However, if users do not have a clearly defined naming convention and wish to pull from multiple SCMSource s, then there is nothing to prevent them from entering an erroneous state where multiple projects for a branch exist in memory trying to share the same config location on the filesystem. This in itself is a problem that is easily encountered, even if the use case of having two jobs for a branch with the same name is not supported.