Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube analysis succeeds but isn't processed by server

Tags:

java

sonarqube

I have recently upgraded our SonarQube server from 5.1.2 to 5.2. We run the analysis using the SonarQube Runner (2.4) via Jenkins and the analysis succeeds. The problem is that the analysis then doesn't get processed by the server. The following error can be seen at the end of the log which is shown for the failed background task:

The main error is this:

java.lang.UnsupportedOperationException: QualityGate status can not be changed if already set on source Measure

I have no idea what this could be referring to... here is more of the logs:

2015.11.05 13:53:18 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute size measures | time=1114ms
2015.11.05 13:53:21 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute new coverage | time=2683ms
2015.11.05 13:53:21 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute coverage measures | time=586ms
2015.11.05 13:53:21 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute comment measures | time=118ms
2015.11.05 13:53:22 INFO  [o.s.s.c.s.ComputationStepExecutor] Copy custom measures | time=947ms
2015.11.05 13:53:22 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=58ms
2015.11.05 13:53:22 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute language distribution | time=80ms
2015.11.05 13:53:22 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute test measures | time=23ms
2015.11.05 13:53:23 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute complexity measures | time=555ms
2015.11.05 13:53:23 INFO  [o.s.s.c.s.ComputationStepExecutor] Load measure computers | time=12ms
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   Execution time for each component visitor:
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - LoadComponentUuidsHavingOpenIssuesVisitor | time=104ms
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - IntegrateIssuesVisitor | time=6566ms
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - CloseIssuesOnRemovedComponentsVisitor | time=0ms
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - SqaleMeasuresVisitor | time=85ms
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - SqaleNewMeasuresVisitor | time=42ms
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - LastCommitVisitor | time=5ms
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - MeasureComputersVisitor | time=30ms
2015.11.05 13:53:30 INFO  [o.s.s.c.s.ComputationStepExecutor] Execute component visitors | time=6924ms
2015.11.05 13:53:33 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute measure variations | time=2634ms
2015.11.05 13:53:33 ERROR [o.s.s.c.t.CeWorkerRunnableImpl] Failed to execute task AVDY_uRG1PIBOHYznvP3
java.lang.UnsupportedOperationException: QualityGate status can not be changed if already set on source Measure
    at org.sonar.server.computation.measure.Measure$UpdateMeasureBuilder.setQualityGateStatus(Measure.java:244) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.step.QualityGateMeasuresStep.updateMeasures(QualityGateMeasuresStep.java:113) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.step.QualityGateMeasuresStep.executeForProject(QualityGateMeasuresStep.java:95) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.step.QualityGateMeasuresStep.access$000(QualityGateMeasuresStep.java:61) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.step.QualityGateMeasuresStep$1.visitProject(QualityGateMeasuresStep.java:85) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitNode(DepthTraversalTypeAwareCrawler.java:63) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:44) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.step.QualityGateMeasuresStep.execute(QualityGateMeasuresStep.java:81) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:39) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor.process(ReportTaskProcessor.java:53) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerRunnableImpl.executeTask(CeWorkerRunnableImpl.java:78) [sonar-server-5.2.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerRunnableImpl.run(CeWorkerRunnableImpl.java:55) [sonar-server-5.2.jar:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_85]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_85]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_85]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_85]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_85]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_85]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_85]

Has anyone seen this before or have any idea what might be wrong?

Thanks.

like image 863
Brian Nurse Avatar asked Nov 05 '15 19:11

Brian Nurse


Video Answer


1 Answers

I have the same problem since upgrade to 5.2. As mentioned in the comment above, I indeed had conditions (coverage on new code) defined for multiple periods (since previous version, since previous analysis, for last 30 days) in my quality gates. It worked like a charm before, now it's broken.

By leaving only one condition for the metric ("coverage on new code since the last version should be 80%") I've managed to bypass the error.

However, I must say it is very annoying that the whole thing is broken now. Multiple periods for the same metric were very useful. For example, "since previous version" shows "how good are we doing since release", and "since previous analysis" shows "how good was the last commit".

like image 175
avysk Avatar answered Oct 07 '22 15:10

avysk