versions used - SonarQube 6.7.3, SCM plugin enabled
We are using SonarQube to analyze Spring Security at Pivotal. When we make a check-in to git, our CI launches a SonarQube job against the appropriate branch (e.g. master or one of a couple feature branches).
Sometimes, two check-ins happen close enough to each other that two SonarQube jobs will run less than a couple of minutes apart. And when those two check-ins are from two different branches, SonarQube will complain with the following exception:
Caused by: java.lang.IllegalArgumentException: There's no changeset on line 117 at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) at org.sonar.server.computation.task.projectanalysis.scm.ScmInfoImpl.getChangesetForLine(ScmInfoImpl.java:66) at org.sonar.server.computation.task.projectanalysis.scm.DbScmInfo.getChangesetForLine(DbScmInfo.java:71) at org.sonar.server.computation.task.projectanalysis.source.ScmLineReader.read(ScmLineReader.java:39) at org.sonar.server.computation.task.projectanalysis.source.ComputeFileSourceData.read(ComputeFileSourceData.java:61) at org.sonar.server.computation.task.projectanalysis.source.ComputeFileSourceData.compute(ComputeFileSourceData.java:48) at org.sonar.server.computation.task.projectanalysis.step.PersistFileSourcesStep$FileSourceVisitor.visitFile(PersistFileSourcesStep.java:120)
I figure that this is because somehow some kind of artifact from the first analysis is lingering while the second analysis is running, and the second analysis complains that the file being analyzed doesn’t look as it should (or as it did the last time).
When looking at the Background Tasks report, the launch time for the second job is after the completion time of the first job (IOW, no overlap), but if they are less than 2-3 minutes apart, then we always see this error.
Can you shed some light on what is happening here? For example, is there some cleanup step that the last job hasn’t completed yet? Is there a way to make the two jobs queue up and wait so that they aren’t clobbering each other?
- steps to reproduce
Use the SCM plugin and point it at a git repo, configured for more than one branch. Launch two jobs close together, one against one branch and the other against another. An SCM background task will fail.
- potential workaround
Perhaps we could solve this by having a project per feature branch; however, we’ve also seen a related bug when the two jobs are for the same branch.