Analyzer Exception

Hi, we tried upgrading sonarqube from version 9.3 to 9.9 but since then the scanner fails for our c++ projects on every run.

We are running Sonarqube Developer Edition Version 9.9 (build 65466) in the official docker container.
The scanner runs on Windows 10, we use the distribution with the built-in JDK, we tried both sonar-scanner 4.7 and 4.8
We are using the build wrapper version 6.41
CFamily plugin version: 6.41.0.60884

When running the scanner, all the threads exit with AnalyzerExceptions on different files, the log shows the following callstacks:

[2023-04-20T21:30:51.246Z] ERROR: Exception in thread pool-4-thread-2
[2023-04-20T21:30:51.246Z] com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code -1073741819: C:\Jenkins\workspace\buildFolder\someDir\myfile.test.cpp
[2023-04-20T21:30:51.246Z] 	at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:40)
[2023-04-20T21:30:51.246Z] 	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
[2023-04-20T21:30:51.246Z] 	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1074)
[2023-04-20T21:30:51.246Z] 	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:58)
[2023-04-20T21:30:51.246Z] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[2023-04-20T21:30:51.246Z] 	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[2023-04-20T21:30:51.246Z] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[2023-04-20T21:30:51.246Z] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[2023-04-20T21:30:51.246Z] 	at java.base/java.lang.Thread.run(Unknown Source)
[2023-04-20T21:30:51.246Z] 
[2023-04-20T21:30:51.246Z] ERROR: Exception in thread pool-4-thread-4
[2023-04-20T21:30:51.246Z] com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code -1073741819: C:\Jenkins\workspace\buildFolder\someDir\otherfile.test.cpp
[2023-04-20T21:30:51.246Z] 	at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:40)
[2023-04-20T21:30:51.246Z] 	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
[2023-04-20T21:30:51.246Z] 	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1074)
[2023-04-20T21:30:51.246Z] 	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:58)
[2023-04-20T21:30:51.246Z] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[2023-04-20T21:30:51.246Z] 	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[2023-04-20T21:30:51.246Z] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[2023-04-20T21:30:51.246Z] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[2023-04-20T21:30:51.246Z] 	at java.base/java.lang.Thread.run(Unknown Source)

I can share the reproducer file in a private message, if needed.

Hi @jsinge, I wrote you a PM.

@Amelie investigated your case and the crash was fixed by CPP-4065. The fix is not backported to LTS as of now. It’s yet to be decided if it’s going to be backported.

For now, you have two options:

  • disable the S6495 rule (the source of the crash)
  • disable the file on which the rule crashes by using the sonar.exclusions property as specified here.

Alternatively, you could also use the latest scanner version, but I’m assuming since you are using LTS, you want to be sick with LTS releases instead of living on the bleeding edge.

2 Likes

Hi Balázs and Amelie,
thanks for the investigation!
We noticed that with older sonarqube versions the files were excluded from the analysis due to a line sonar.global.exclussion=**/*.test.cpp in the sonar-project.properties file, this seems to get ignored in version 9.9. Changing it to sonar.exclusions therefore fixed the issue for us :slight_smile:

It also seems to work when including the files in sonar.test.inclusions, maybe then S6495 is not applied?

Hello @jsinge,

The CFamily analyzer does not support sonar.tests (see the paragraph Unsupported properties: sonar.tests in the documentation). So every file included with this property is ignored by the analyzer.
So, indeed, S6495 (as well as all the other CFamily rules) is not applied for the files in sonar.tests.inclusions, which is why it works.

Best,
Amélie

1 Like

Ah, thanks for pointing out!

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