Azure Service Fabric build - OutOfMemory

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
    Using SonarCloud, Azure DevOps integration in build pipeline using latest version from Marketplace (1.11?)
  • error observed (wrap logs/code around triple quote ``` for proper formatting)

	at org.sonar.ucfg.protobuf.UcfgProtos$UCFG.<init>(na:2219)
	at org.sonar.ucfg.protobuf.UcfgProtos$UCFG$1.J(na:869)
	at org.sonar.ucfg.protobuf.UcfgProtos$UCFG.<init>(na:3040)
	at org.sonar.ucfg.protobuf.UcfgProtos$UCFG.<init>(na:2219)
	at org.sonar.ucfg.protobuf.UcfgProtos$UCFG$1.J(na:869)
##[error]at org.sonar.ucfg.protobuf.UcfgProtos$UCFG$1.parsePartialFrom(na:1352)
	at com.google.protobuf.AbstractParser.parsePartialFrom(na:3542)
	at com.google.protobuf.AbstractParser.parseFrom(na:1427)
	at org.sonar.ucfg.protobuf.UcfgProtos$UCFG$1.parsePartialFrom(na:1352)
	at com.google.protobuf.AbstractParser.parsePartialFrom(na:3542)
	at com.google.protobuf.AbstractParser.parseFrom(na:1427)
##[error]at com.google.protobuf.AbstractParser.parseFrom(na:1001)
	at com.google.protobuf.AbstractParser.parseFrom(na:1940)
	at com.google.protobuf.AbstractParser.parseFrom(na:1001)
	at com.google.protobuf.AbstractParser.parseFrom(na:1940)
##[error]at com.google.protobuf.GeneratedMessageV3.parseWithIOException(na:3233)
	at org.sonar.ucfg.protobuf.UcfgProtos$UCFG.parseFrom(na:1048)
	at com.sonar.A.D.A(na:482)
	at com.google.protobuf.GeneratedMessageV3.parseWithIOException(na:3233)
	at org.sonar.ucfg.protobuf.UcfgProtos$UCFG.parseFrom(na:1048)
	at com.sonar.A.D.A(na:482)
##[error]at com.sonar.A.D.A(na:2091)
	at com.sonar.security.G.readUcfg(na:2520)
	at com.sonar.security.G.execute(na:130)
	at com.sonar.A.D.A(na:2091)
	at com.sonar.security.G.readUcfg(na:2520)
	at com.sonar.security.G.execute(na:130)
##[error]at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:34)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:78)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:34)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:78)
##[error]at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:54)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:68)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:54)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:68)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:418)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:414)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:418)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:414)
  • steps to reproduce
    Setup a CI build pipeline for an Azure Service Fabric application
  • potential workaround

I’m evaluating the use of SonarCloud in my company to see if it can bring any value to our day-to-day product development. I’m familiar with static code analysis tools (basic knowledge), but very limited, hence I wanted to see what SonarCloud is and what the value is it can bring, as it looks a very promising product!

Now, we have a regular build pipeline to build our Service Fabric application, which is a .SLN with roughly 60 ASP.NET Core projects. I’ve followed the guide, and:

  • Added the ‘Prepare analysis’ task, making sure ‘Integrate with MSBuild’ is checked
  • Added the ‘Run Code Analysis’ after our dotnet test step
  • Added the ‘Publish Quality Gate Result’ step after publishing artifacts

I noticed however, that our ‘Build solution .sfproj’ (The SF project file linking all individual microservices) execution time increased from merely a few minutes to 35minutes, and our dotnet test step faced the same issue, increased from a few minutes to 25minutes.
Only to crash on the Run Code Analysis step with above error.
Something is not right here, it looks as if it’s doing the analysis multiple times, as I can see the same warnings popping up in the different steps:

The amount of warnings is as such a bit too high (I hope :D)

Hi @Mortana and welcome to the community !

Do you run the build on your own agent or you are using a Microsoft-hosted one ?

Thanks.

Hello,

Thanks! We’re running this on our own build servers. Windows machines which have Java installed for this.

Thanks. And how many RAM is dedicated to the JVM (heap space) ? Are you noticing a huge amount of CPU also while running the analysis ?

I haven’t checked yet, Will do first thing tomorrow. But it is clear though that it’s running the analysis multiple times, which is the culprit I think?

Our build server is indeed hitting 100% CPU usage peaks, but it’s not constantly. I’d say it’s averaging around 75% CPU.

The machine has 8GB of RAM, and it’s consuming roughly 6GB. CSC.exe is the one using a lot of CPU and ram.
What I don’t understand is, that the step 'Build solution **.*.sln" ran in 4minutes, and gave all the warnings needed, buit the next step (specific to service fabric CIs), 'Build solution ***.sfproj" is taking 40 minutes before crashing because an out of memory.
This step surely is getting in some sort of loop I think?

In fact Service Fabric are a bit specific.

What i can propose here is to build your SLN, execute then the SonarCloud analysis. It will then uninstall all the targets that hooks into the build, and then after run the build of your .sfproj.

Indeed you may have to be happy with the outcome of the SLN “only” in terms of analysis, let us know.

Thanks !

Hi Mickael,

This worked, thanks for that!
Perhaps this should be added as a remark to the Azure Devops guideline?

1 Like

Sure, i filed a ticket for that : https://github.com/SonarSource/sonar-scanner-msbuild/issues/869

Thanks !

1 Like

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