LLVM Error during analysing C++ code by sonar-scanner running on Windows host

SonarQube Developer Edition 9.9.1 LTS
Jenkins 2.401.3 LTS
SonarQube deployed inside Kubernetes with Docker image

SonarScanner runs on Windows 2019 Server (24GB RAM, 4 CPU, 50GB HDD )
Sonar-scanner 4.8.0.2856
Build configuration for SonarScanner provided by Build Wrapper
Microsoft Visual Studio Professional 2017 15.9.56

Hi Community.
We are using SonarQube in our CI infrastructure for analysing the C++ code. Sonar scanner executes on on host with installed Windows Server 2019 and runs with -‘DXmx=20g’ flag. But during the sonar scanner execution we faced with the following issue:

13:00:00.917  03:00:00.341 INFO: [pool-2-thread-1] C:/Users/some_user/Some_Workspace/SomeFileOne.cpp
13:00:00.917  03:00:00.341 DEBUG: Cache miss for C:\Users\some_user\Some_Workspace\SomeFileAnotherFile.cpp: response file not found, request changed
13:00:05.108  LLVM ERROR: out of memory
13:00:05.108  Allocation failed
13:00:06.042  03:00:05.490 INFO: Reached stage: configuration
13:00:06.042  03:00:05.490 DEBUG: Reproducer logs:
13:00:06.042  03:00:05.490 DEBUG: [PCH] C:/Users/some_user/Some_Workspace/SomeFileOne.cpp: using PCH
13:00:06.042  03:00:05.490 DEBUG: [PCH] C:/Users/some_user/Some_Workspace/SomeFileOne.cpp: building PCH
13:00:06.042  03:00:05.490 INFO: Requesting reproducer for: C:/Users/some_user/Some_Workspace/SomeFileOne.cpp
13:00:10.229  03:00:09.334 ERROR: Exception in thread pool-2-thread-1
13:00:10.229  com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code -1073740791: C:/Users/some_user/Some_Workspace/SomeFileOne.cpp
13:00:10.229  	at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:40)
13:00:10.229  	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
13:00:10.229  	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1074)
13:00:10.229  	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:58)
13:00:10.229  	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
13:00:10.229  	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
13:00:10.229  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
13:00:10.229  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
13:00:10.229  	at java.base/java.lang.Thread.run(Unknown Source)
13:00:10.229  
13:00:10.229  03:00:09.428 ERROR: 
13:00:10.229  An error occurred while analyzing the following compilation unit: 
13:00:10.229    C:/Users/some_user/Some_Workspace/SomeFileOne.cpp
13:00:10.229  A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
13:00:10.229  Please contact SonarSource support providing the following file to help improving the analyzer:
13:00:10.229    C:\Users\some_user\Some_Workspace\sonar-cfamily-reproducer.zip
13:00:10.229  
13:00:10.795  03:00:10.131 INFO: ------------------------------------------------------------------------
13:00:10.795  03:00:10.131 INFO: EXECUTION FAILURE
13:00:10.795  03:00:10.131 INFO: ------------------------------------------------------------------------
13:00:10.795  03:00:10.131 INFO: Total time: 39.415s
13:00:10.795  03:00:10.209 INFO: Final Memory: 35M/124M03:00:10.209 ERROR: Error during SonarScanner execution
13:00:10.795  03:00:10.209 INFO: ------------------------------------------------------------------------
13:00:10.795  
13:00:10.795  java.lang.IllegalStateException: 
13:00:10.795  An error occurred while analyzing the following compilation unit: 
13:00:10.795    C:/Users/some_user/Some_Workspace/SomeFileOne.cpp
13:00:10.795  A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
13:00:10.795  Please contact SonarSource support providing the following file to help improving the analyzer:
13:00:10.795    C:\Users\some_user\Some_Workspace\sonar-cfamily-reproducer.zip

The amount of RAM and Disk space on the host is enough. We tried to change different amount of Xmx (from 8GB to 20 GB) but the issue still was the same.

Could You please help to find a solution for this issue. We can provide “sonar-cfamily-reproducer.zip” file in DM if it needs.
Great thanks!

hi @yevhenhnes,

The C++ analyzer is written in C++ and you are increasing Java memory; it won’t have any effect.

The analysis is failing while building PCH, I believe the compilation of that PCH is requiring more memory than is available. I will send you an internal property privately to check my theory.

Thanks,

FYI, the error disappeared after the update of the sonar-scanner to 5.0.1.3006

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