CFamily plugin crashing during scan with gcc 4.9.1 output


(Tamas Csabina) #1


Using the latest CFamily plugin ( there are problems with scanning projects that are built with gcc 4.9.1.

This is a Developer Edition server, which was recently update to the latest version (7.6). Reverting the plugin to an older version ( solve the problem.
The last lines of the output with the new plugin:

23:58:32.251 INFO: ------------------------------------------------------------------------
23:58:32.251 INFO: ------------------------------------------------------------------------
23:58:32.252 INFO: Total time: 10.137s
23:58:32.366 INFO: Final Memory: 31M/425M
23:58:32.367 INFO: ------------------------------------------------------------------------
23:58:32.367 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: java.lang.IllegalStateException: exit code != 0
at com.sonar.cpp.N.F.A(na:1714)
at com.sonar.cpp.plugin.R.B(na:3237)
at com.sonar.cpp.plugin.R.A(na:1306)
at com.sonar.cpp.plugin.R.execute(na:156)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(
at org.sonar.core.platform.ComponentContainer.startComponents(
at org.sonar.core.platform.ComponentContainer.execute(
at org.sonar.scanner.scan.ProjectScanContainer.scan(
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(
at org.sonar.core.platform.ComponentContainer.startComponents(
at org.sonar.core.platform.ComponentContainer.execute(
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(
at org.sonar.core.platform.ComponentContainer.startComponents(
at org.sonar.core.platform.ComponentContainer.execute(
at org.sonar.batch.bootstrapper.Batch.doExecute(
at org.sonar.batch.bootstrapper.Batch.execute(
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
at org.sonarsource.scanner.api.EmbeddedScanner.execute(
at org.sonarsource.scanner.cli.Main.execute(
at org.sonarsource.scanner.cli.Main.execute(
at org.sonarsource.scanner.cli.Main.main(
Caused by: java.lang.IllegalStateException: exit code != 0
at com.sonar.cpp.N.E.A(na:869)
at com.sonar.cpp.N.E.A(na:444)
at com.sonar.cpp.plugin.R.A(na:2250)
at com.sonar.cpp.N.F.B(na:50)
at java.util.concurrent.Executors$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succedeed?
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE

I know that gcc 4.9.1 is old, but we cannot just switch to a new version suddenly.
Is this a known limitation of the new CFamily plugin? And if yes, what is the minimum version of gcc that is working fine with the latest plugin?

(Massimo Paladin) #3

Hi @tcsabina,

could you please share the full analysis log and not just the final stacktrace?

(Tamas Csabina) #4

Hi Massimo,

How can I attach files to a topic?
Or alternatively, I could send an email, but not sure what email address to use.


(Tamas Csabina) #5

Found it… scan-output.txt (30.6 KB)

(Massimo Paladin) #6

Could you please rerun the specifying this additional parameter?


It should create a file named sonar-cfamily.reproducer in the project folder which you should share with me to help in the investigation, send it privately if it contains sensitive information.

(Tamas Csabina) #7

Hi Massimo,

Didn’t really work:

E:\Jenkins\Slave\workspace\cc_prs>e:\Tools\sonar-scanner-\bin\sonar-scanner.bat sonar.cfamily.reproducer=e:/Jenkins/Slave/workspace/cc_prs/src/implement/diag_cfg.c -X
20:56:06.713 INFO: Scanner configuration file: e:\Tools\sonar-scanner-\bin…\conf\
20:56:06.723 INFO: Project root configuration file: E:\Jenkins\Slave\workspace\cc_prs\
20:56:06.741 INFO: SonarQube Scanner
20:56:06.742 INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
20:56:06.744 INFO: Windows NT (unknown) 10.0 amd64
20:56:06.904 DEBUG: keyStore is :
20:56:06.905 DEBUG: keyStore type is : jks
20:56:06.906 DEBUG: keyStore provider is :
20:56:06.908 DEBUG: init keystore
20:56:06.909 DEBUG: init keymanager of type SunX509
20:56:07.058 DEBUG: Create: C:\Users\Administrator.sonar\cache
20:56:07.061 INFO: User cache: C:\Users\Administrator.sonar\cache
20:56:07.062 DEBUG: Create: C:\Users\Administrator.sonar\cache_tmp
20:56:07.067 DEBUG: Extract sonar-scanner-api-batch in temp…
20:56:07.088 DEBUG: Get bootstrap index…
20:56:07.088 DEBUG: Download: http://kvmech.myserver/sonarqube/batch/index
20:56:07.168 DEBUG: Get bootstrap completed
20:56:07.199 DEBUG: Create isolated classloader…
20:56:07.209 DEBUG: Start temp cleaning…
20:56:07.217 DEBUG: Temp cleaning done
20:56:07.218 DEBUG: Execution getVersion
20:56:07.223 INFO: SonarQube server 7.6.0
20:56:07.227 DEBUG: Execution execute
20:56:07.636 INFO: Load global settings
20:56:07.832 DEBUG: GET 200 http://kvmech.myserver/sonarqube/api/settings/values.protobuf | time=186ms
20:56:07.863 INFO: Load global settings (done) | time=229ms
20:56:07.867 INFO: Server id: 49B321BC-15e61e72daf081c
20:56:07.890 INFO: User cache: C:\Users\Administrator.sonar\cache
20:56:08.118 INFO: Load/download plugins
20:56:08.118 INFO: Load plugins index
20:56:08.159 DEBUG: GET 200 http://kvmech.myserver/sonarqube/api/plugins/installed | time=40ms
20:56:08.201 INFO: Load plugins index (done) | time=83ms
20:56:08.281 DEBUG: Download plugin ‘scmmercurial’ to ‘C:\Users\Administrator.sonar_tmp\fileCache7460141700642485360.tmp’
20:56:08.291 DEBUG: GET 200 http://kvmech.myserver/sonarqube/api/plugins/download?plugin=scmmercurial&acceptCompressions=pack200 | time=9ms
20:56:09.244 INFO: Load/download plugins (done) | time=1126ms
20:56:09.537 DEBUG: Plugins:
20:56:09.538 DEBUG: * SonarCSS (cssfamily)
20:56:09.539 DEBUG: * Svn (scmsvn)
20:56:09.539 DEBUG: * SonarPLSQL (plsql)
20:56:09.540 DEBUG: * SonarScala (sonarscala)
20:56:09.541 DEBUG: * SonarC# (csharp)
20:56:09.541 DEBUG: * Vulnerability Analysis (security)
20:56:09.542 DEBUG: * SonarJava (java)
20:56:09.543 DEBUG: * LDAP (ldap)
20:56:09.543 DEBUG: * SonarHTML (web)
20:56:09.544 DEBUG: * SonarFlex (flex)
20:56:09.545 DEBUG: * SonarXML (xml)
20:56:09.546 DEBUG: * SonarTS (typescript)
20:56:09.546 DEBUG: * SonarVB (vbnet)
20:56:09.549 DEBUG: * SonarSwift (swift)
20:56:09.549 DEBUG: * SonarCFamily (cpp)
20:56:09.550 DEBUG: * SonarPython (python)
20:56:09.550 DEBUG: * JaCoCo (jacoco)
20:56:09.551 DEBUG: * Mercurial 1.1.2 (scmmercurial)
20:56:09.552 DEBUG: * SonarGo (go)
20:56:09.552 DEBUG: * SonarKotlin (kotlin)
20:56:09.553 DEBUG: * SonarTSQL (tsql)
20:56:09.553 DEBUG: * SonarJS (javascript)
20:56:09.554 DEBUG: * SonarRuby (ruby)
20:56:09.555 DEBUG: * Vulnerability Rules for C# (securitycsharpfrontend)
20:56:09.555 DEBUG: * Vulnerability Rules for Java (securityjavafrontend)
20:56:09.556 DEBUG: * License for SonarLint 7.6 (license)
20:56:09.556 DEBUG: * Git (scmgit)
20:56:09.559 DEBUG: * SoftVis3D Sonar plugin 1.0.1 (softvis3d)
20:56:09.559 DEBUG: * SonarPHP (php)
20:56:09.560 DEBUG: * SonarABAP (abap)
20:56:09.561 DEBUG: * Vulnerability Rules for PHP (securityphpfrontend)
20:56:09.562 DEBUG: * SVG Badges 3.0.1 (status)
20:56:09.586 INFO: Loaded core extensions: branch-scanner
20:56:09.642 INFO: ------------------------------------------------------------------------
20:56:09.644 INFO: ------------------------------------------------------------------------
20:56:09.644 INFO: Total time: 2.961s
20:56:09.717 INFO: Final Memory: 16M/256M
20:56:09.717 INFO: ------------------------------------------------------------------------
20:56:09.719 ERROR: Error during SonarQube Scanner execution
20:56:09.719 ERROR: Tasks support was removed in SonarQube 7.6.


I guess, this is not what you were/are expecting…

(Tamas Csabina) #8

The above was generated with the following line:
e:\Tools\sonar-scanner-\bin\sonar-scanner.bat sonar.cfamily.reproducer=e:/Jenkins/Slave/workspace/cc_prs/src/implement/diag_cfg.c -X

I was not sure where to add this extra parameter, so I added at the command line.

Seeing the error (“Tasks support was removed…”) I though maybe it should not be a command line parameter, but an extra line in the file.
After adding the extra line into and running the scanner, I got different errors. See attachment.

I get the message: Please contact SonarSource Support and provide file E:\Jenkins\Slave\workspace\cc_prs\sonar-cfamily.reproducer
scanner-output.txt (30.5 KB)

But the sonar-cfamily.reproducer is not there at all.

I see others also struggling to generate this reproducer file: Crash (IllegalStateException) during C++ analysis

(Massimo Paladin) #9

Hi @tcsabina,

if you are facing issues to create a reproducer, could you please try to create a minimalistic project which reproduce the issue and share it with us?

(Tamas Csabina) #10

Hi Massimo,

While I tried to create a minimalistic project, I discovered that if I change the directory name of the project, the scanner is not crashing.
For example, to original folder name is cc_prs. If I renamed it to test, or even to cc_prs_, the scanner is working and the analyses finishes.

Could this give you some hint, guys?
I am bit struggling to create the minimalistic project, as I have to guard our IP, yet create a project that crashes. On top of this, a simple directory rename makes the whole issue disappear…

(Massimo Paladin) #11

Hi @tcsabina,

if you did that keeping the property sonar.cfamily.reproducer=e:/Jenkins/Slave/workspace/cc_prs/src/implement/diag_cfg.c it’s normal that there is no crash anymore, because the analyzer doesn’t do anything in such case because the filename doesn’t match, hence no crash. Is it the case?