All scans now fail! SonarScanner 4.6.2.2472 java.lang.OutOfMemoryError: Java heap space

Version

  • SonarQube 9.5 Enterprise,

  • Scanner: SonarScanner 4.6.2.2472

  • what are you trying to achieve?: Full Scan of our product

  • what have you tried so far to achieve this?: We tried to run this locally with more Java heap space with same result. (Strange thing is that in the log i seems like there is 1gb of memory left)

INFO: Analyzing 88751 functions to detect bugs.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:15:22.008s
INFO: Final Memory: 2194M/3072M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.OutOfMemoryError: Java heap space
	at com.sonarsource.A.B.P$$Lambda$2925/0x00000008010a5040.get$Lambda(Unknown Source)
	at java.base/java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(Unknown Source)
	at java.base/java.lang.invoke.Invokers$Holder.linkToTargetMethod(Unknown Source)
	at com.sonarsource.A.B.P.A(na:2470)
	at com.sonarsource.A.B.P.B(na:3166)
	at com.sonarsource.A.B.P$$Lambda$2923/0x00000008010a5840.accept(Unknown Source)
	at java.base/java.util.ArrayList.forEach(Unknown Source)
	at com.sonarsource.A.B.P.<init>(na:2886)
	at com.sonarsource.A.B.S$_B.A(na:30)
	at com.sonarsource.A.B.C$_A.A(na:1886)
	at com.sonarsource.A.B.C$_A$$Lambda$2921/0x00000008010a6040.apply(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at com.sonarsource.A.B.C$_A.A(na:297)
	at com.sonarsource.A.B.C.A(na:1323)
	at com.sonarsource.A.B.readIrFile(na:2827)
	at com.sonarsource.A.B.executeChecks(na:1136)
	at com.sonarsource.A.B.execute(na:1732)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:81)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:392)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:388)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:357)
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

We got it to work by changing the heap space memory to 4gb on Jenkins (from 3gb). This is strange since we tried it locally with 8gb, at least now it works (and it still says in final memory that it has not consumed 3gb but it might not be the case for the entire scan)

image

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