Sonar Scanner Error on iOS analysis: IllegalStateException: exit code != 0

versions used

  • SonarQube: 6.7.4.38452
  • Scanner: 4.0.0.1744 (Java 11.0.3 AdoptOpenJDK, Mac OS X 10.15.1 x86_64)
  • Plugin: 6.4 (build 11646)

error observed

for individual files:

[2019-11-28T16:41:36.274Z] ERROR: Exception in thread pool-3-thread-3
[2019-11-28T16:41:36.274Z] java.lang.IllegalStateException: exit code != 0
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:54)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:25)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$4(CFamilySensor.java:351)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:53)
[2019-11-28T16:41:36.274Z] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.lang.Thread.run(Unknown Source)

in the summary:

[2019-11-28T16:41:36.274Z] ERROR: Error during SonarQube Scanner execution
[2019-11-28T16:41:36.274Z] java.lang.IllegalStateException: java.lang.IllegalStateException: exit code != 0
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.analyzer.AnalysisExecutor.submit(AnalysisExecutor.java:47)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:338)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:307)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:206)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:73)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:177)
[2019-11-28T16:41:36.274Z] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
[2019-11-28T16:41:36.274Z] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:291)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:286)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:264)
[2019-11-28T16:41:36.274Z] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
[2019-11-28T16:41:36.274Z] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
[2019-11-28T16:41:36.274Z] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
[2019-11-28T16:41:36.274Z] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
[2019-11-28T16:41:36.274Z] 	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
[2019-11-28T16:41:36.274Z] 	at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
[2019-11-28T16:41:36.274Z] 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
[2019-11-28T16:41:36.274Z] 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
[2019-11-28T16:41:36.274Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2019-11-28T16:41:36.274Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
[2019-11-28T16:41:36.274Z] 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
[2019-11-28T16:41:36.274Z] 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
[2019-11-28T16:41:36.274Z] 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
[2019-11-28T16:41:36.274Z] 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
[2019-11-28T16:41:36.274Z] 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
[2019-11-28T16:41:36.274Z] Caused by: java.lang.IllegalStateException: exit code != 0
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:54)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:25)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$4(CFamilySensor.java:351)
[2019-11-28T16:41:36.274Z] 	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:53)
[2019-11-28T16:41:36.274Z] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[2019-11-28T16:41:36.274Z] 	at java.base/java.lang.Thread.run(Unknown Source)

has been reported twice/thrice

please call @mpaladin :wink:

additional info

  • this is a short-living branch. works on other sl-branches, ll-branches, and PRs.
  • full debug log is available, but needs to be treated confidentially (commercial project)

Hello @Patric_Schenke,

SonarCFamily 6.5 is released. It contains a lot of fixes and the reported exception might be one of them. Please update your plugin and let me know if you still face this exception.

Note: the reported exception is generic and has nothing to do with the other issues that you referenced.

Thanks

2 Likes

Hi @Abbas,

unfortunately, this is not an option we can try immediately. As stated in the original report, we are still on 6.7 LTS. CFamily 6.5 would require us to update the whole system to 7.9 LTS. This would currently be a disruptive change and I cannot justify that with one branch that throws exceptions. Especially when that branch contains no changes in code, just an updated dependency.

Could you offer another solution if I sent you the full debug log?

Hello @Patric_Schenke,

I can have a look. I will need the sonar-cfamily.reproducer file to debug the issue.
To generate this file you will have to run the scanner after adding this property to your configuration sonar.cfamily.reproducer = *directory to the file triggering the exception*.
You can find the directory to the file triggering the exception by following this part of the log :

If the generated file contains sensitive information you can share it with me privately.

1 Like

Thanks. We are running in a multi-threaded environment and all four threads throw that exception. It seems to be for multiple files. Can I use a comma-separated list for that property?

There is high probability that it is the same issue with the different files. Generate the reproducer for any of the files that are triggering the exception.

1 Like

The build is running but will take ~30 minutes.
Meanwhile I tried to figure out how to share anything privately with you - but cannot seem to find a way here :frowning: am I missing something?

To send a message to a user you have to click on the user avatar and then click on Message.

@Abbas: that’s what I expected after reading the discord documentation and upgrading my rank to “Basic” - however, the button is not there :frowning: maybe I need to login again, but for now I replied to your message. thank you :slight_smile:

1 Like

The problem was in my pipeline, which reused the BuildData patch for different XCode stages: build, clang analyzer and unit tests. Interestingly enough, the problem only appeared on one branch, after updating some dependencies.
I fixed it by using separate directories for each stage. @Abbas’s analysis pointed me in the right direction. Thanks again for the detailed help and sorry to take up so much of your time with my own mistake :see_no_evil:

3 Likes