- ALM used: Bitbucket Cloud
- CI system used: Bitbucket Cloud - Linux shell runner (on prem)
- Scanner command used: sonar-scanner -Dproject.settings=$SRCDIR_UNIX/sonar-project.properties -Dsonar.cfamily.cache.path=$SONAR_HOME/ccache
- Properties
- sonar.projectKey=(…)
- sonar.organization=(…)
- sonar.host.url=https://sonarcloud.io
- sonar.cfamily.build-wrapper-output=build/buildspace/bw-output
- sonar.cfamily.cache.enabled=true
- Properties
- Languages of the repository: Mainly C++ using the Qt Framework
- Error observed:
socar-scanner hangs when analyzing few specific source files for more than one hour. The spawned subprocesses of the scanner end up using more than 100GB of RAM, until the OOM killer of the Linux kernel kills them.
Issue started to occur after we started using C++20 coroutines together with the QCoro library in a feature branch. The problem occurs in this branch only.
I managed to get a reproducer zip by manually killing one of the scanner-subprocesses after it used up 20GB of RAM, which i can share via PM.
The following log is from a run where I didn’t manually kill the subprocesses:
INFO: Reached stage: AST rules
INFO: Requesting reproducer for: /mnt/workspaces/gfdevbuildqtjammy64/atlassian-bitbucket-pipelines-runner/temp/d5dc2ef9-62d8-5f99-8452-be612d103454/build/gfInternetReceiver/apiworker/actionlistworker.cpp
ERROR: Exception in thread pool-5-thread-23
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code 137: /mnt/workspaces/gfdevbuildqtjammy64/atlassian-bitbucket-pipelines-runner/temp/d5dc2ef9-62d8-5f99-8452-be612d103454/build/gfInternetReceiver/apiworker/actionlistworker.cpp
at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:40)
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1074)
at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:58)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
ERROR:
An error occurred while analyzing the following compilation unit:
/mnt/workspaces/gfdevbuildqtjammy64/atlassian-bitbucket-pipelines-runner/temp/d5dc2ef9-62d8-5f99-8452-be612d103454/build/gfInternetReceiver/apiworker/actionlistworker.cpp
A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
/mnt/workspaces/gfdevbuildqtjammy64/atlassian-bitbucket-pipelines-runner/temp/d5dc2ef9-62d8-5f99-8452-be612d103454/build/sonar-cfamily-reproducer.zip
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:30:23.950s
INFO: Final Memory: 68M/348M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException:
An error occurred while analyzing the following compilation unit:
/mnt/workspaces/gfdevbuildqtjammy64/atlassian-bitbucket-pipelines-runner/temp/d5dc2ef9-62d8-5f99-8452-be612d103454/build/gfInternetReceiver/apiworker/actionlistworker.cpp
A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
/mnt/workspaces/gfdevbuildqtjammy64/atlassian-bitbucket-pipelines-runner/temp/d5dc2ef9-62d8-5f99-8452-be612d103454/build/sonar-cfamily-reproducer.zip
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:442)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:51)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:468)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:464)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:420)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:130)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)