AnalyzerException

Versions:

  • Developer Edition v2025.1 (102418)
  • Scanner 7.2.0.5079

Log (excerpt):

12:54:20  10:54:20.544 ERROR Exception in thread pool-5-thread-32
12:54:20  com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code 139: /repo/leon/pmc/controller/mainTask.cpp
12:54:20    at com.sonar.cpp.analyzer.Subprocess.lambda$execute$1(Subprocess.java:43)
12:54:20    at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:128)
12:54:20    at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:39)
12:54:20    at com.sonar.cpp.analyzer.ReproducerRequester.requestReproducer(ReproducerRequester.java:37)
12:54:20    at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:76)
12:54:20    at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:128)
12:54:20    at com.sonar.cpp.plugin.CFamilySensor.lambda$process$14(CFamilySensor.java:856)
12:54:20    at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:58)
12:54:20    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
12:54:20    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
12:54:20    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
12:54:20    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
12:54:20    at java.base/java.lang.Thread.run(Unknown Source)
...
12:54:33  10:54:32.958 ERROR 
12:54:33  An error occurred while analyzing the following compilation unit: 
12:54:33    /repo/leon/pmc/controller/mainTask.cpp
12:54:33  A file named "sonar-cfamily-reproducer.tar.xz" has been generated to help the problem investigation.
12:54:33  Please contact SonarSource support providing the following file to help improving the analyzer:
12:54:33    /var/opt/jenkins/workspace/Leon_leon_MR-1275/sonar-cfamily-reproducer.tar.xz
12:54:33  
12:54:45  10:54:44.149 INFO  Time spent writing ucfgs 0ms
12:54:45  10:54:44.262 ERROR Error during SonarScanner Engine execution
12:54:45  java.lang.IllegalStateException: 
12:54:45  An error occurred while analyzing the following compilation unit: 
12:54:45    /repo/leon/pmc/controller/mainTask.cpp
12:54:45  A file named "sonar-cfamily-reproducer.tar.xz" has been generated to help the problem investigation.
12:54:45  Please contact SonarSource support providing the following file to help improving the analyzer:
12:54:45    /var/opt/jenkins/workspace/Leon_leon_MR-1275/sonar-cfamily-reproducer.tar.xz
12:54:45  
12:54:45    at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:281)
12:54:45    at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:190)
12:54:45    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
12:54:45    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
12:54:45    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
12:54:45    at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
12:54:45    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
12:54:45    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
12:54:45    at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:201)
12:54:45    at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:197)
12:54:45    at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:170)
12:54:45    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
12:54:45    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
12:54:45    at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:350)
12:54:45    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
12:54:45    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
12:54:45    at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:142)
12:54:45    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
12:54:45    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
12:54:45    at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:151)
12:54:45    at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:66)
12:54:45    at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:52)
12:54:45  
12:54:45  10:54:44.641 INFO  EXECUTION FAILURE
12:54:45  10:54:44.643 INFO  Total time: 1:04.525s
``

I have saved the reproducer file of another run, which I cannot share publicly.

Hi @neuschwander ,

do you have the change to try 2025.4 to see if the problem is still there?

I am going to send you a private message.

I think an update to 2025.4 could be possible in the long run, but it’s nothing we can do just now. If it turns out that the problem will be fixed in the next release, I can ask the admins to update.

Hello @neuschwander,

Sorry for the delay in answering you. I’ve be able to reproduce the issue and reduce it to a more simple example. Unfortunately, upgrading to 2025.4 will not solve the issue. We are using clang to parse your code, and it makes clang crash until clang 20.1. More recent versions of clang handle it correctly, but we are not using them yet.

However, I think this crash is fortunate, because the problem is linked to a part of your code that I believe is a bug. Your code looks like:

struct BitField {
  bool a : 1 = false;
  bool b : 1 = false;
  bool c : 1 = false;
};

template <typename T>
struct Data
{
  Data()
  {
	BitField mode = static_cast<BitField>(0b111);
  }
};

I think that the intent is to initialize the 3 bits of BitField to true, but the code will use use aggregate initialization to initialize a to 0b111 (converted to true), and leave b and c to their default value of false. Fixing this should make the analysis work properly.

I’m sending you a private mail with the accurate location of the suspicious code in your codebase.

2 Likes

Hi @mpaladin and @JolyLoic .

You are correct that this was a bug. We fixed the bug and the scanner works fine since then. I guess sooner or later this will be fixed by moving to a newer clang version. So this issue is closed from my point of view.

Thanks for your support.

3 Likes

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