Randomly throw com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0

Dar all,

I use SonarScanner 4.7.0.2747
on a Windows 10
with Visual Studio 2022
plugin: CFamily Code Quality and Security 6.30.0.42324 (cpp)
SonarQube: Developer 9.3.0.51899

I get this error message:
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0

Randomly throw this error for various files, but always at the first when write this: INFO: Requesting reproducer for:…

I tried to add:
ASIO_DISABLE_NOEXCEPT and BOOST_ASIO_DISABLE_NOEXCEPT but I don’t use BOOST library…

before 2022. december, 22, it works, december 23. it not works :frowning:
Please help

Thanks

Hi,

Welcome to the community!

The current SonarQube version is 9.8. Can you upgrade and try again?

 
Ann

Hi,

Thank you. I cannot update the sonarqube server because whole company use this, but it works until 2022. dec. 22 and nobody changed anything :frowning:
I think I have the problem with the subprocess.exe, can I do anything to see any detailed error?

Hi,

Try adding -Dsonar.verbose=true to your analysis command line.

 
HTH,
Ann

Hi,

I added the extra parameter, but I see this in the log:
WARN: Property ‘sonar.verbose’ with value ‘true’ is overridden with value ‘true’

and didn’t write more information :frowning:

Hi,

You wanna post your logs?

 
Ann

Sure
The error:

01:48:55  01:48:54.699 ERROR: Exception in thread pool-3-thread-11
01:48:55  com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: myfile.cpp
01:48:55  	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:132)
01:48:55  	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:52)
01:48:55  	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$14(CFamilySensor.java:779)
01:48:55  	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
01:48:55  	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
01:48:55  	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
01:48:55  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
01:48:55  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
01:48:55  	at java.base/java.lang.Thread.run(Unknown Source)

Next part:

01:48:56  An error occurred while analyzing the following compilation unit: 
01:48:56    myfile.cpp
01:48:56  A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
01:48:56  Please contact SonarSource support providing the following file to help improving the analyzer:
01:48:56    sonar-cfamily-reproducer.zip
01:48:56  
01:48:57  01:48:57.066 INFO: ------------------------------------------------------------------------
01:48:57  01:48:57.066 INFO: EXECUTION FAILURE
01:48:57  01:48:57.066 INFO: ------------------------------------------------------------------------
01:48:57  01:48:57.066 INFO: Total time: 41.982s
01:48:57  01:48:57.188 INFO: Final Memory: 34M/134M
01:48:57  01:48:57.188 INFO: ------------------------------------------------------------------------
01:48:57  01:48:57.188 ERROR: Error during SonarScanner execution
01:48:57  java.lang.IllegalStateException: 
01:48:57  An error occurred while analyzing the following compilation unit: 
01:48:57    myfile.cpp
01:48:57  A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
01:48:57  Please contact SonarSource support providing the following file to help improving the analyzer:
01:48:57    sonar-cfamily-reproducer.zip
01:48:57  
01:48:57  	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:436)
01:48:57  	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:183)
01:48:57  	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
01:48:57  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
01:48:57  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
01:48:57  	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:79)
01:48:57  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
01:48:57  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
01:48:57  	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:384)
01:48:57  	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:380)
01:48:57  	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:349)
01:48:57  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
01:48:57  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
01:48:57  	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:136)
01:48:57  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
01:48:57  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
01:48:57  	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
01:48:57  	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
01:48:57  	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
01:48:57  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
01:48:57  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
01:48:57  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
01:48:57  	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
01:48:57  	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
01:48:57  	at com.sun.proxy.$Proxy0.execute(Unknown Source)
01:48:57  	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
01:48:57  	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
01:48:57  	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
01:48:57  	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
01:48:57  	at org.sonarsource.scanner.cli.Main.main(Main.java:61)

Hi @Endre_Vass!
By reading the logs, I found that it refers to sonar-cfamily-reproducer.zip.
Could you please upload it here if it can be publicly shared or whisper it to me otherwise to be able to track down the crash?

Hi!

I cannot do that, because this zip contains the source code :frowning: and I dont have permission to share that.
Can I see something in this file?

I’m not sure how far can we get without a reproducer.

I would recommend bisecting the commits to find the one that introduces the crash of the scanner.
From that, you might be able to craft a case which no longer contains sensitive information and can be publicly shared. Alternatively, you might be able to recognize a code pattern that causes the crash in your case and share that.

You can try to exclude the crashing file to unblock your CI using the sonar.exclusions, but I would not recommend this for the long term.

Hi

Full random which file throw this error. I use stdafx and precompiled header, so I think the first file which try to analyze includes the header which contains the error :frowning:

We don’t change anything on the server or on the scanner, and it works at 2022. dec. 22. (I run sonar nightly). and stopped working at 2022. dec. 23. … i try to make a demo project to reproduce the issue

I would also recommend trying to upgrade to the latest SonarQube version (9.8), it could be very well that we actually already fixed the issue. Give it a try.

It turned out that by upgrading to the latest SonarQube the scanner no longer crashes.

The release of SonarQube 9.9 LTS is almost here, so I would still recommend further upgrading to that version when it’s released.

2 Likes

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