'Multiple entries with same key' failure when submitting Background Task

background_task
scanner
swift
sonarqube

(Lindsey Harris) #1

SonarQube Version: 7.2.1.14109

I am running sonar-scanner for my swift project and I am getting the following error:

12:28:00.714 INFO: EXECUTION FAILURE
12:28:00.714 INFO: ------------------------------------------------------------------------
12:28:00.714 INFO: Total time: 6.582s
12:28:00.845 INFO: Final Memory: 42M/603M
12:28:00.846 INFO: ------------------------------------------------------------------------
12:28:00.846 ERROR: Error during SonarQube Scanner execution
12:28:00.846 ERROR: The 'report' parameter is missing

My sonar-project.properties file has:

sonar.projectKey=Setec
sonar.projectName=Setec
sonar.projectVersion=2.0
sonar.language = swift

sonar.swift.project=Setec.xcodeproj
sonar.swift.workspace=Setec.xcworkspace
sonar.tests=CCAppTests
sonar.sources=src
sonar.swift.appName=Setec
sonar.verbose=true
sonar.sourceEncoding=UTF-8
sonar.swift.appScheme=Setec
sonar.swift.simulator=platform=iOS Simulator,name=iPhone 8,OS=11.1

My sonar-scanner.properties file has:

sonar.sources=../../Setec/Setec/
sonar.projectKey=Setec
sonar.projectName=Setec
sonar.sourceEncoding=UTF-8

I have googled for a report parameter but I don’t see anything. My server is up and running.


(G Ann Campbell) #2

Hi,

There’s really not enough to go on here. Why don’t you try turning on debug logging and we’ll see if the error message gets more helpful.

Ann


(Lindsey Harris) #3

Thank you for your response. I turned on my computer this morning and now reports are going up but I am getting an error on the server:
Error Details

java.lang.IllegalArgumentException: Multiple entries with same key: swift=Swift and swift=Swift at 
com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:150) at 
com.google.common.collect.RegularImmutableMap.checkNoConflictInBucket(RegularImmutableMap.java:104) at 
com.google.common.collect.RegularImmutableMap.(RegularImmutableMap.java:70) at 
com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:254) at 
com.google.common.collect.Maps.uniqueIndex(Maps.java:1166) at 
com.google.common.collect.Maps.uniqueIndex(Maps.java:1140) at 
org.sonar.server.computation.task.projectanalysis.language.LanguageRepositoryImpl.(LanguageRepositoryImpl.java:46) at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at 
java.lang.reflect.Constructor.newInstance(Constructor.java:423) at 
org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145) at 
org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342) at 
org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) at 
org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) at 
org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) at 
org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) at 
org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) at 
org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) at 
org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) at 
org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632) at 
org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) at 
org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) at 
org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) at 
org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309) at 
org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335) at 
org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) at 
org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) at 
org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) at 
org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) at 
org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) at 
org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) at 
org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) at 
org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678) at 
org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:281) at 
org.sonar.server.computation.task.projectanalysis.step.AbstractComputationSteps.lambda$instances$0(AbstractComputationSteps.java:43) at 
com.google.common.collect.Iterators$8.transform(Iterators.java:799) at 
com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) at 
org.sonar.server.computation.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:62) at 
org.sonar.server.computation.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52) at 
org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:73) at 
org.sonar.ce.taskprocessor.CeWorkerImpl.executeTask(CeWorkerImpl.java:134) at 
org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:97) at 
org.sonar.ce.taskprocessor.CeWorkerImpl.withCustomizedThreadName(CeWorkerImpl.java:81) at 
org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:73) at 
org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:43) at 
java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at 
java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at 
java.lang.Thread.run(Thread.java:745)

(G Ann Campbell) #4

Hi,

To be clear, this was in ce.log?

Also, are other analyses being processed okay, or are they all failing?

Ann


(Lindsey Harris) #5

I found it in the error log for my background task on the server. I am very new to this so I apologies if I am using the wrong terms. I do also see it in the ce.log file ce.txt (34.6 KB)


(G Ann Campbell) #6

No need to apologize. :slight_smile:
It’s potentially useful to know that this is showing up in both the background log and the ce.log.

Now, is it just this one project failing, or are multiple or all projects failing?


(Lindsey Harris) #7

I only have one project linked. My project is compiling in xcode with no errors as well as running test successfully.


(Lindsey Harris) #8

I think that my problems boils down to me having the homebrew version of sonar-scanner and sonar on my computer but I am trying to run my project from a local developer instance of the server. I tried to get the homebrew developer version of sonar but it isn’t working. I tried to put the swift plugin in the homebrew sonar extension but that was a failed long shot. Also, I ran the sonar-scanner command and the run-sonar-swift.sh script in my project.
I am making a couple assumptions in my theory.


(G Ann Campbell) #9

Hi,

I asked whether multiple projects were failing in an attempt to diagnose whether we’re looking at a project-level or instance-level issue.

Multiple entries with same key: swift=Swift and swift=Swift
Is very odd, and makes me wonder whether you’ve installed two plugins that declare the language.

So, could you clarify which Swift analyzer(s) you’re running?

Ann


(Lindsey Harris) #10

I only have one project set up with sonar so it’s the only one failing, I have installed sonar and sonar-scanner from homebrew but I am actively using an instance of sonar developer and sonar scanner on my desktop. I am analyzing the project by the backlight swift script in my project.
When I run sonar from terminal, it complains about not having swift available.


(Nicolas Bontoux) #11

Hi Lindsey,

Do you mean that you’re using the SonarQube Developer Edition ? If so then be aware that this Edition includes a built-in Swift analyzer (SonarSwift). Which in turns means:

You cannot run two analyzers for the same language on a SonarQube instance. For the moment I would recommend uninstalling Backelite/sonar-swift , and keeping SonarSwift only (the one built-in the Developer Edition).


(Lindsey Harris) #12

I tried that and I get: You must install a plugin that supports the language ‘swift’
To get to this point, I uninstalled sonar and sonar-scanner in homebrew, restarted my computer and didn’t load any local instances of sonar, reinstalled sonar and sonar-scanner with homebrew, started a server via sonar console and sonar start, went to my project folder and ran sonar-scanner -X

SonarScanner.txt (15.9 KB)


(Nicolas Bontoux) #13

Hi Lindsey,

It’s important you clarify the following:

By developer, do you mean you have a license for using the Developer Edition ?

(if so then make sure to download/use the corresponding Edition) Asking because I want to make sure which Swift analyzer you intend to use.


(Lindsey Harris) #14

By sonar developer I mean that I am running the developer version of the server 7.2.1. What am I suppose to be downloading at the corresponding edition link?


(Nicolas Bontoux) #15

Simply make sure you get the Developer Edition, which you can then verify by looking at the footer in the SonarQube UI. The reason I ask is that I noticed this in the logs you shared:

08:29:46.158 DEBUG: Plugins:
08:29:46.158 DEBUG:   * SonarPython 1.10.0.2131 (python)
08:29:46.159 DEBUG:   * SonarCSS 1.0.1.508 (cssfamily)
08:29:46.159 DEBUG:   * SonarGo 1.1.0.1612 (go)
08:29:46.159 DEBUG:   * SonarKotlin 1.0.1.965 (kotlin)
08:29:46.159 DEBUG:   * Svn 1.8.0.1168 (scmsvn)
08:29:46.159 DEBUG:   * SonarJS 4.2.0.6476 (javascript)
08:29:46.160 DEBUG:   * SonarC# 7.3.2.6129 (csharp)
08:29:46.160 DEBUG:   * SonarJava 5.6.1.15064 (java)
08:29:46.160 DEBUG:   * LDAP 2.2.0.608 (ldap)
08:29:46.160 DEBUG:   * Git 1.4.1.1128 (scmgit)
08:29:46.160 DEBUG:   * SonarFlex 2.4.0.1222 (flex)
08:29:46.161 DEBUG:   * SonarXML 1.5.1.1452 (xml)
08:29:46.161 DEBUG:   * SonarPHP 2.14.0.3569 (php)
08:29:46.161 DEBUG:   * SonarTS 1.7.0.2893 (typescript)

SonarSwift is nowhere to be found, whereas it’s present by default in the Developer Edition (I’ve just checked it’s there in the Developer Edition offered to download).


(Lindsey Harris) #16

Thank you for taking the time to look at the logs. Here is from my local host:


(Lindsey Harris) #17

And from the admin menu of my local host


(Lindsey Harris) #18

I removed the homebrew version of sonar and sonar-scanner I get the following error when processing my code:
run-sonar-swift.sh: line 123: sonar-scanner: command not found

ERROR - Command 'sonar-scanner ’ failed with error code: 127

I installed the brew version of sonar-scanner back and I got
java.lang.IllegalArgumentException: Multiple entries with same key: swift=Swift and swift=Swift


(Nicolas Bontoux) #19

Alright. At this stage can I ask you to share the full debug logs of the scanner-side analysis (sonar.verbose=true), together with the full debug logs of the related Background Task ? That will give the end-to-end view, with a better chance at narrowing down the choking point.


(Lindsey Harris) #20

I hope that I did what you wanted:
I added sonar.verbose=true to the sonar-project.properties file in my project.
Then I ran run-sonar-swift.sh that is in my project and I got the logs found in the runsonar file. I have put my server logs in the serverlogs fileserverlogs.txt (5.6 KB)
runsonar.txt (20.5 KB)