OutOfMemoryError during Code Coverage on AzureDevops

Hi,

I am encountering an OutOfMemoryError during the Code Coverage part on my Azure DevOps build.
I tried to find a solution myself online but couldn’t find any so here I am looking for help.

Hope you guys will be able to help me !

  • ALM used => Azure DevOps
  • CI system used => Azure DevOps
  • Languages of the repository C#, .Net Framework 4.7
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
04:12:24.282 INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=10922ms
04:12:24.282 INFO: Sensor C# Unit Test Results Import [csharp]
04:12:24.282 INFO: Parsing the Visual Studio Test Results file C:\agent\_work\25\s\TestResults\TFSBuild_BATCH1_2019-10-03_03_15_45.trx
04:12:24.407 INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=125ms
04:12:24.407 INFO: Sensor JavaSecuritySensor [security]
04:12:24.407 INFO: Reading type hierarchy from: C:\agent\_work\25\.sonarqube\out\.sonar\ucfg2\java
04:12:24.407 INFO: Read 0 type definitions
04:12:24.422 INFO: Reading UCFGs from: C:\agent\_work\25\.sonarqube\out\.sonar\ucfg2\java
04:12:24.422 INFO: No UCFGs have been included for analysis.
04:12:24.422 INFO: Sensor JavaSecuritySensor [security] (done) | time=15ms
04:12:24.422 INFO: Sensor CSharpSecuritySensor [security]
04:12:24.422 INFO: Reading type hierarchy from: C:\agent\_work\25\.sonarqube\out\ucfg_cs2
04:12:39.094 INFO: Read 5482 type definitions
04:12:39.141 INFO: Reading UCFGs from: C:\agent\_work\25\.sonarqube\out\ucfg_cs2
04:14:43.545 INFO: ------------------------------------------------------------------------
04:14:43.545 INFO: EXECUTION FAILURE
04:14:43.545 INFO: ------------------------------------------------------------------------
04:14:43.545 INFO: Total time: 6:12.916s
04:14:43.592 INFO: Final Memory: 23M/247M
##[error]04:14:43.592 ERROR: Error during SonarQube Scanner execution
java.lang.OutOfMemoryError: Java heap space
##[debug]Processed: ##vso[task.logissue type=error;]04:14:43.592 ERROR: Error during SonarQube Scanner execution%0D%0Ajava.lang.OutOfMemoryError: Java heap space
04:14:43.592 ERROR: Error during SonarQube Scanner execution
java.lang.OutOfMemoryError: Java heap space
04:14:43.592 INFO: ------------------------------------------------------------------------
##[error]at com.google.protobuf.UnknownFieldSet$Builder.create(na:1202)
##[debug]Processed: ##vso[task.logissue type=error;]at com.google.protobuf.UnknownFieldSet$Builder.create(na:1202)
	at com.google.protobuf.UnknownFieldSet$Builder.create(na:1202)
##[error]at com.google.protobuf.UnknownFieldSet$Builder.access$000(na:1174)
	at com.google.protobuf.UnknownFieldSet.newBuilder(na:747)
	at org.sonar.ucfg.protobuf.Ucfg$Location.<init>(na:15040)
	at org.sonar.ucfg.protobuf.Ucfg$Location.<init>(na:16889)
##[debug]Processed: ##vso[task.logissue type=error;]at com.google.protobuf.UnknownFieldSet$Builder.access$000(na:1174)%0D%0A	at com.google.protobuf.UnknownFieldSet.newBuilder(na:747)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$Location.<init>(na:15040)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$Location.<init>(na:16889)
	at com.google.protobuf.UnknownFieldSet$Builder.access$000(na:1174)
	at com.google.protobuf.UnknownFieldSet.newBuilder(na:747)
	at org.sonar.ucfg.protobuf.Ucfg$Location.<init>(na:15040)
	at org.sonar.ucfg.protobuf.Ucfg$Location.<init>(na:16889)
##[error]at org.sonar.ucfg.protobuf.Ucfg$Location$1.P(na:15324)
	at org.sonar.ucfg.protobuf.Ucfg$Location$1.parsePartialFrom(na:16949)
##[debug]Processed: ##vso[task.logissue type=error;]at org.sonar.ucfg.protobuf.Ucfg$Location$1.P(na:15324)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$Location$1.parsePartialFrom(na:16949)
	at org.sonar.ucfg.protobuf.Ucfg$Location$1.P(na:15324)
	at org.sonar.ucfg.protobuf.Ucfg$Location$1.parsePartialFrom(na:16949)
##[error]at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)
	at org.sonar.ucfg.protobuf.Ucfg$Return.<init>(na:10193)
	at org.sonar.ucfg.protobuf.Ucfg$Return.<init>(na:8171)
##[debug]Processed: ##vso[task.logissue type=error;]at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$Return.<init>(na:10193)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$Return.<init>(na:8171)
	at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)
	at org.sonar.ucfg.protobuf.Ucfg$Return.<init>(na:10193)
	at org.sonar.ucfg.protobuf.Ucfg$Return.<init>(na:8171)
##[error]at org.sonar.ucfg.protobuf.Ucfg$Return$1.H(na:8743)
	at org.sonar.ucfg.protobuf.Ucfg$Return$1.parsePartialFrom(na:7606)
##[debug]Processed: ##vso[task.logissue type=error;]at org.sonar.ucfg.protobuf.Ucfg$Return$1.H(na:8743)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$Return$1.parsePartialFrom(na:7606)
	at org.sonar.ucfg.protobuf.Ucfg$Return$1.H(na:8743)
	at org.sonar.ucfg.protobuf.Ucfg$Return$1.parsePartialFrom(na:7606)
##[error]at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)
##[debug]Processed: ##vso[task.logissue type=error;]at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)
	at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)
##[error]at org.sonar.ucfg.protobuf.Ucfg$BasicBlock.<init>(na:1440)
	at org.sonar.ucfg.protobuf.Ucfg$BasicBlock.<init>(na:2232)
	at org.sonar.ucfg.protobuf.Ucfg$BasicBlock$1.G(na:6931)
##[debug]Processed: ##vso[task.logissue type=error;]at org.sonar.ucfg.protobuf.Ucfg$BasicBlock.<init>(na:1440)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$BasicBlock.<init>(na:2232)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$BasicBlock$1.G(na:6931)
	at org.sonar.ucfg.protobuf.Ucfg$BasicBlock.<init>(na:1440)
	at org.sonar.ucfg.protobuf.Ucfg$BasicBlock.<init>(na:2232)
	at org.sonar.ucfg.protobuf.Ucfg$BasicBlock$1.G(na:6931)
##[error]at org.sonar.ucfg.protobuf.Ucfg$BasicBlock$1.parsePartialFrom(na:5760)
	at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)
##[debug]Processed: ##vso[task.logissue type=error;]at org.sonar.ucfg.protobuf.Ucfg$BasicBlock$1.parsePartialFrom(na:5760)%0D%0A	at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)
	at org.sonar.ucfg.protobuf.Ucfg$BasicBlock$1.parsePartialFrom(na:5760)
	at com.google.protobuf.CodedInputStream$StreamDecoder.readMessage(na:1725)
##[error]at org.sonar.ucfg.protobuf.Ucfg$UCFG.<init>(na:3429)
	at org.sonar.ucfg.protobuf.Ucfg$UCFG.<init>(na:1938)
##[debug]Processed: ##vso[task.logissue type=error;]at org.sonar.ucfg.protobuf.Ucfg$UCFG.<init>(na:3429)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$UCFG.<init>(na:1938)
	at org.sonar.ucfg.protobuf.Ucfg$UCFG.<init>(na:3429)
	at org.sonar.ucfg.protobuf.Ucfg$UCFG.<init>(na:1938)
##[error]at org.sonar.ucfg.protobuf.Ucfg$UCFG$1.J(na:2855)
	at org.sonar.ucfg.protobuf.Ucfg$UCFG$1.parsePartialFrom(na:27)
##[debug]Processed: ##vso[task.logissue type=error;]at org.sonar.ucfg.protobuf.Ucfg$UCFG$1.J(na:2855)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$UCFG$1.parsePartialFrom(na:27)
	at org.sonar.ucfg.protobuf.Ucfg$UCFG$1.J(na:2855)
	at org.sonar.ucfg.protobuf.Ucfg$UCFG$1.parsePartialFrom(na:27)
##[error]at com.google.protobuf.AbstractParser.parsePartialFrom(na:600)
	at com.google.protobuf.AbstractParser.parseFrom(na:572)
	at com.google.protobuf.AbstractParser.parseFrom(na:765)
	at com.google.protobuf.AbstractParser.parseFrom(na:3533)
	at com.google.protobuf.GeneratedMessageV3.parseWithIOException(na:1856)
	at org.sonar.ucfg.protobuf.Ucfg$UCFG.parseFrom(na:3182)
	at com.sonar.A.D.A(na:1827)
	at com.sonar.A.D.A(na:1327)
##[debug]Processed: ##vso[task.logissue type=error;]at com.google.protobuf.AbstractParser.parsePartialFrom(na:600)%0D%0A	at com.google.protobuf.AbstractParser.parseFrom(na:572)%0D%0A	at com.google.protobuf.AbstractParser.parseFrom(na:765)%0D%0A	at com.google.protobuf.AbstractParser.parseFrom(na:3533)%0D%0A	at com.google.protobuf.GeneratedMessageV3.parseWithIOException(na:1856)%0D%0A	at org.sonar.ucfg.protobuf.Ucfg$UCFG.parseFrom(na:3182)%0D%0A	at com.sonar.A.D.A(na:1827)%0D%0A	at com.sonar.A.D.A(na:1327)
	at com.google.protobuf.AbstractParser.parsePartialFrom(na:600)
	at com.google.protobuf.AbstractParser.parseFrom(na:572)
	at com.google.protobuf.AbstractParser.parseFrom(na:765)
	at com.google.protobuf.AbstractParser.parseFrom(na:3533)
	at com.google.protobuf.GeneratedMessageV3.parseWithIOException(na:1856)
	at org.sonar.ucfg.protobuf.Ucfg$UCFG.parseFrom(na:3182)
	at com.sonar.A.D.A(na:1827)
	at com.sonar.A.D.A(na:1327)
##[error]at com.sonar.security.H.readUcfg(na:3079)
	at com.sonar.security.H.execute(na:130)
##[debug]Processed: ##vso[task.logissue type=error;]at com.sonar.security.H.readUcfg(na:3079)%0D%0A	at com.sonar.security.H.execute(na:130)
	at com.sonar.security.H.readUcfg(na:3079)
	at com.sonar.security.H.execute(na:130)
Process returned exit code 1
##[error]The SonarQube Scanner did not complete successfully
##[debug]Processed: ##vso[task.logissue type=error;]The SonarQube Scanner did not complete successfully
The SonarQube Scanner did not complete successfully
##[error]04:14:43.639  Post-processing failed. Exit code: 1
##[debug]Processed: ##vso[task.logissue type=error;]04:14:43.639  Post-processing failed. Exit code: 1
04:14:43.639  Post-processing failed. Exit code: 1

Hi,

Can you try adding this environment variable : SONAR_SCANNER_OPTS with this kind of value :
-Xmx512M (or higher)

in order to increase your heap space, which appears to be 256Mo

Let us know.

Thanks

Mickaël

1 Like

From what I understood, I should set this as a Pipeline Variable

I have queued a build and should get the results shortly.

Thanks for your help.

1 Like

It worked, thanks :slight_smile: