Out of memory persisting duplications

I am facing the similar issue.

I have included two code in property
export sonar_scanner_opts="-Xmx8192m" earlier added but was not working
export -Dsonar.ce.javaOpts="-Xmx8192m" added this one as well

still getting the same error.

Hi @lokesh_bawariya,

There’s not much we can do to help you without more details. For instance, the exact error message, and some context around it would be a good start.

 
Ann

java.lang.OutOfMemoryError: Java heap space
	at java.base/java.util.Arrays.copyOfRange(Unknown Source)
	at java.base/java.lang.StringLatin1.newString(Unknown Source)
	at java.base/java.lang.StringBuilder.toString(Unknown Source)
	at org.sonar.ce.task.projectanalysis.step.PersistDuplicationDataStep$DuplicationVisitor.generateMeasure(PersistDuplicationDataStep.java:155)
	at org.sonar.ce.task.projectanalysis.step.PersistDuplicationDataStep$DuplicationVisitor.computeDuplications(PersistDuplicationDataStep.java:109)
	at org.sonar.ce.task.projectanalysis.step.PersistDuplicationDataStep$DuplicationVisitor.visitFile(PersistDuplicationDataStep.java:104)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitNode(DepthTraversalTypeAwareCrawler.java:76)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:51)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:95)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:95)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:95)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54)
	at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
	at org.sonar.ce.task.projectanalysis.step.PersistDuplicationDataStep.execute(PersistDuplicationDataStep.java:83)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:81)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:72)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:59)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:209)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:191)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:158)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$$Lambda$1214/0x0000000100786c40.apply(Unknown Source)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:133)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:85)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

I am getting the above error even if i give the Sonar 16 GB of ram in conf.

file size sent from jenkins to analyse is 182 MB.

Hi,

Thanks for the logs. It confirms

  • the error is server-side
  • the error is in the Compute Engine

Would you confirm that you’re

  • setting the heap size value in $SONARQUBE-HOME/conf/sonar.properties
  • encountering the problem in SonarQube 8.1?

 
Ann

I am using sonarcube version 7.9.2

export SONAR_SCANNER_OPTS="-Xmx8192m"

Anything else do i need to set in conf file

Hi,

To effect how analysis reports are processed by the compute engine, i.e. to deal with the error you’re seeing, you need to make the change in the file I mentioned above and restart your server.

 
Ann

I have made the changes.
can you please elaborate if something else is required.