SonarLint CFamily Errors

Versions
SonarSource SonarLint Core - OSGi bundle 8.0.1.42120 org.sonarsource.sonarlint.core.sonarlint-core-osgi
SonarSource SonarLint for Eclipse 7.2.1.42550 org.sonarlint.eclipse.ui
SonarSource SonarLint for Eclipse CDT 7.2.1.42550 org.sonarlint.eclipse.cdt

C source files in project. Since the latest updates my files are not getting any new issues identified. Initially I thought I had just become a true master, alas no.

Execute Sensor: CFamily
CFamily plugin version: 6.30.0.42324
Using build-wrapper output: ...\.metadata\.plugins\org.eclipse.core.resources\.projects\org.sonarlint.eclipse.core\sonarlint8051772549077897464\build-wrapper-dump.json
Available processors: 12

CFamily plugin supports multithreaded analysis:

* to enable multithreaded analysis
  please specify the number of threads to use
  by setting the following property to your analysis:
  sonar.cfamily.threads=number_of_threads

* if you do not want to enable multithreading
  please explicitly disable it
  by setting the following property to your analysis:
  sonar.cfamily.threads=1

* visit the documentation page for more information
  {SonarQube URL}/documentation/analysis/languages/cfamily/

Using 1 thread for analysis according to value of "sonar.cfamily.threads" property.

CFamily plugin supports incremental analysis with the use of a cache:

* if you do not want to enable cache
  please explicitly disable it
  by setting the following property to your analysis:
  sonar.cfamily.cache.enabled=false

* to enable cache please specify the following 2 options:
  sonar.cfamily.cache.enabled=true
  sonar.cfamily.cache.path=relative_or_absolute_path_to_cache_location

* visit the documentation page for more information
  {SonarQube URL}/documentation/analysis/languages/cfamily/

Using build-wrapper-dump.json probe
[pool-17-thread-1] ...\embedded_project\Application\Src\update_process.c
Exception in thread pool-17-thread-1
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: ...\embedded_project\Application\Src\update_process.c
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:132)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:52)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$14(CFamilySensor.java:779)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Error executing sensor: 'CFamily'
java.lang.IllegalStateException: com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: ...\embedded_project\Application\Src\update_process.c
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:438)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:183)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.execute(SensorsExecutor.java:72)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:122)
	at org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer.startComponents(ComponentContainer.java:119)
	at org.sonarsource.sonarlint.core.plugin.commons.pico.ComponentContainer.execute(ComponentContainer.java:104)
	at org.sonarsource.sonarlint.core.analysis.container.module.ModuleContainer.analyze(ModuleContainer.java:71)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:58)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:32)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:150)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:70)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: ...\embedded_project\Application\Src\update_process.c
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:132)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:52)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$14(CFamilySensor.java:779)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	... 1 more

'Scala Sensor' skipped because there is no related files in the current project
Execute Sensor: HTML
Execute Sensor: Sonar Secrets Detection Sensor
'PL/SQL Sensor' skipped because there is no related files in the current project
Found 0 issue(s)
Done in 1797 ms

This is the verbose output after saving a file. Progress shows it is processing the file, but it never goes beyond 0%

Hello @DevAV,

To see what happens, we would need a reproducer file. For that, you should add the property sonar.cfamily.reproducer with the value ...\embedded_project\Application\Src\update_process.c to the analysis.

To do that, you can go to “Window” > “Preferences” > “SonarLint” > “Analyzer Properties”.

In the log, you should see that a file is generated. Please send it to us. If you think this file contains private information, let us know, we’ll send you a private message that will allow you to send it privately.

Hi,

If I replace paths in the files, will that be a problem? I am replacing “c:\foo\bar” with “{path}”

I have done it
sonar-cfamily-reproducer-sanitised.zip (54.4 KB)

Hi,

Yes, it is a problem. The tools we use to read the reproducer cannot work if it has been tampered with.

Private way please

Hello again @DevAV,

I’m starting to see what might be the issue, but I would need more details. Could you also add the option sonar.verbose with a value of true, and send me the new generated sonar-cfamily-reproducer.zip (on the same private thread)

Add it in the same place as the sonar.cfamily.reproducer?

When I do, the output is the same, except for the timestamps

extraProperties: {…, sonar.verbose=true} appears on the debug console

1 Like

You can enable verbose output in the SonarLint console:
image

1 Like

That was enabled for the first reporducer I provided

Sorry, I hoped to be able to see more info, but I’ll have to do with what I have…

Can you tell us what compiler you are using?

As a workaround, could you add a macro definition in your project that defines the macro __SIZEOF_LONG_LONG__ to be equal to 4, and tell us if that solves the issue?

Thank you!

GNU Tools for STM32 (9-2020-q2-update)
based on gcc-arm-none-eabi-9-2020-q2-update
Provided by STM32CubeIDE V1.8.0

Adding the define has removed one of the stack traces from the error log, updated reproducer file sent. New issues are now being shown in the IDE

From a message in the log, I think you might want to define __SIZEOF_LONG_LONG__ to 8 instead of 4, but for the rest, it looks like SonanLint is now working correctly.

You have a remaining stack trace in the log because of the sonar.cfamily.reproducer property that you can now remove.

I created a ticket to better support the root cause of your issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.