New projects are not scanned anymore - throwing TooManyResultsException

Hi,

We’ve been experiencing some strange behavior when scanning projects with sonar-scanner and updating the project settings within sonar.

We are currently using:

  • SonarQube Developer Edition Version 9.2.4 (build 50792)
  • SonarScanner - sonar-scanner-msbuild-5.3.1.36242-net46

We noticed lately that 3 new (C#) projects that are not scanned anymore. The first few builds work as they should, and then all of a sudden (after 4 builds) it started failing with the following exception:

build	26-Oct-2022 13:34:37	     [exec] java.lang.IllegalStateException: Failed to get the New Code definition: Error 500 on http://<SonarAddress>/api/new_code_periods/show.protobuf?project=<Project>&branch=<Branch> : {"errors":[{"msg":"An error has occurred. Please contact your administrator"}]}
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.repository.DefaultNewCodePeriodLoader.load(DefaultNewCodePeriodLoader.java:45)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.repository.ForkDateSupplier.get(ForkDateSupplier.java:64)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.report.MetadataPublisher.addForkPoint(MetadataPublisher.java:118)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.report.MetadataPublisher.publish(MetadataPublisher.java:96)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.report.ReportPublisher.generateReportFile(ReportPublisher.java:163)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:137)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:357)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:136)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
build	26-Oct-2022 13:34:37	     [exec]  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
build	26-Oct-2022 13:34:37	     [exec]  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
build	26-Oct-2022 13:34:37	     [exec]  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
build	26-Oct-2022 13:34:37	     [exec]  at java.base/java.lang.reflect.Method.invoke(Method.java:568)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
build	26-Oct-2022 13:34:37	     [exec]  at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonarsource.scanner.cli.Main.main(Main.java:61)
build	26-Oct-2022 13:34:37	     [exec] Caused by: org.sonarqube.ws.client.HttpException: Error 500 on http://<SonarAddress>/api/new_code_periods/show.protobuf?project=<Project>&branch=<Branch> : {"errors":[{"msg":"An error has occurred. Please contact your administrator"}]}
build	26-Oct-2022 13:34:37	     [exec]  at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:36)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.bootstrap.DefaultScannerWsClient.failIfUnauthorized(DefaultScannerWsClient.java:112)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.bootstrap.DefaultScannerWsClient.call(DefaultScannerWsClient.java:75)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.repository.DefaultNewCodePeriodLoader.call(DefaultNewCodePeriodLoader.java:51)
build	26-Oct-2022 13:34:37	     [exec]  at org.sonar.scanner.repository.DefaultNewCodePeriodLoader.load(DefaultNewCodePeriodLoader.java:43)
build	26-Oct-2022 13:34:37	     [exec]  ... 25 more

After seeing this error we’ve started digging a bit further. The 3 projects still needed some changes on the “Project Settings > New Code” tab.
But the thing here is that we are not able to change anything on the page. We are presented with the following:


That is of course unexpected.
Looking at the sonarqube_web.log we see this exception on exactly the same time as opening the “New Code” page:

2022.10.26 13:34:37 ERROR web[AYLpetBwUrow4KDlWOpe][o.s.s.w.WebServiceEngine] Fail to process request http://localhost:9000/api/new_code_periods/show.protobuf?project=<ProjectName>&branch=<BranchName>
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:80)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87)
	at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
	at com.sun.proxy.$Proxy69.selectByProject(Unknown Source)
	at org.sonar.db.newcodeperiod.NewCodePeriodDao.selectByProject(NewCodePeriodDao.java:79)
	at org.sonar.server.newcodeperiod.ws.ShowAction.get(ShowAction.java:140)
	at org.sonar.server.newcodeperiod.ws.ShowAction.lambda$get$7(ShowAction.java:147)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at org.sonar.server.newcodeperiod.ws.ShowAction.get(ShowAction.java:147)
	at org.sonar.server.newcodeperiod.ws.ShowAction.handle(ShowAction.java:112)
	at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:111)
	at org.sonar.server.platform.web.WebServiceFilter.doFilter(WebServiceFilter.java:84)
	at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:139)
	at org.sonar.server.platform.web.SonarLintConnectionFilter.doFilter(SonarLintConnectionFilter.java:66)
	at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:139)
	at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:108)
	at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:148)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:143)
	at org.sonar.server.platform.web.UserSessionFilter.doFilter(UserSessionFilter.java:81)
	at org.sonar.server.platform.web.UserSessionFilter.doFilter(UserSessionFilter.java:68)
	at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:148)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:143)
	at org.sonar.server.platform.web.CacheControlFilter.doFilter(CacheControlFilter.java:76)
	at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:148)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:143)
	at org.sonar.server.platform.web.SecurityServletFilter.doHttpFilter(SecurityServletFilter.java:75)
	at org.sonar.server.platform.web.SecurityServletFilter.doFilter(SecurityServletFilter.java:47)
	at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:148)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:143)
	at org.sonar.server.platform.web.RedirectFilter.doFilter(RedirectFilter.java:57)
	at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:148)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:143)
	at org.sonar.server.platform.web.RequestIdFilter.doFilter(RequestIdFilter.java:66)
	at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:148)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:143)
	at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:62)
	at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:148)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:143)
	at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
	at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:282)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:279)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/javax.security.auth.Subject.doAsPrivileged(Subject.java:550)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:314)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:253)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:47)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:148)
	at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:143)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:196)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
	at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:256)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:364)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:624)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1650)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:829)

After seeing this error (same exception when running the sonar-scanner) we tried to see if we could find any related things inside the database. At least to us this looks like there is some duplicate entry in the database.
We found the following for one of the projects inide the “new_code_periods” table:


We used the following query to get to this result (after finding the project id inside the ‘projects’ table):

select * from new_code_periods where project_uuid = 'AYQN29oKyp45krS7zUzI'

For a working project, where we’ve setup the ‘New Code’ as we wanted to, we do not see full duplicates (except primary key). We see this:


Since there is no documentation available for the database and we cannot easily see where these project uuids are being used, we found it a bit dangerous to try deleting records from this table.

We did find one possible solution to solve the above issue(s). That is simply deleting the project and let it be automatically created again when we run a build.
But obviously we will loose the scanned history here.
And this also feels like a quick patch to mask the actual problem instead of properly fixing it. Or at least understanding what the problem actually is here.

For some more context: In all 3 cases where we’ve seen this issue, we created a new project in source control (git), directly created a feature branch and started working from there. so there has been no scan run on master (since there is no code yet).

We hope that anyone may have some insights in what is going on here and fix the underying issue :slight_smile:

Hopefully all above makes (somewhat) sense. Please let me know if further details are needed!

1 Like

Hey @merijn ,

In all 3 cases where we’ve seen this issue, we created a new project in source control (git), directly created a feature branch, and started working from there.

Thanks a lot for the detailed instructions, though I’m still missing some information to be able to reproduce that issue.

Was that project already created in SonarQube or not? If yes what was the new code period settings look like?

How do you execute scanner? Do you pass any additional parameters?

Hey @jacek.poreda,

The project is created when running the build with the sonar-scanner. So we do not make use of the SonarQube UI to create a project.

I assume you are talking about new code under the project settings menu? If so, then those settings were left at the default settings. The idea is that we are updating it to something else and then discovered one of the mentioned problems.

The scanner is executed with the following parameters:

-D sonar.projectKey=<ProjectName> -D sonar.projectName=<ProjectName> -D sonar.projectVersion=<version> -D sonar.sources="assemblies" -D sonar.tests="tests"

Configuration sonar-scanner.properties consists of the following:

sonar.host.url=http://<sonar>:80

sonar.tests=tests
sonar.sources=assemblies,deployments

sonar.cs.ncover3.reportsPaths=report/tmp/coverage-result-unittests.xml
sonar.sourceEncoding=utf-8

It is probably good to know that our process went as follows (in this order):

  • Create new project in source control
  • Create feature branch
  • Do a modification on the project
  • Run a build that executes sonar-scanner with above parameters
  • sonar-scanner uploads its report to SonarQube
  • Result is shown in sonar (initially)
    Few builds later (do not know how many it took) it started failing without any settings changed on SonarQube itself

Hope this helps :slight_smile:

Hey @merijn ,

I have checked the code a few times and I cannot see any other way to insert those duplicates, unless you have either executed WS at exactly the same time, which is very unlikely or someone executed an SQL query on the database which lead to this situation.

Is there anything specific in your pipeline that could be also doing operations on SQ?