Java heap space ERROR in newly upgraded sonar

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) -V6.7.6
  • what are you trying to achieve - Testing the analysis
  • what have you tried so far to achieve this -

We get this error when we did an analysis:

java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:3332)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:649)
	at java.lang.StringBuilder.append(StringBuilder.java:202)
	at org.sonar.server.computation.task.projectanalysis.filemove.ScoreMatrix$1.visit(ScoreMatrix.java:69)
	at org.sonar.server.computation.task.projectanalysis.filemove.ScoreMatrix.accept(ScoreMatrix.java:45)
	at org.sonar.server.computation.task.projectanalysis.filemove.ScoreMatrix.toCsv(ScoreMatrix.java:60)
	at org.sonar.server.computation.task.projectanalysis.filemove.FileMoveDetectionStep.printIfDebug(FileMoveDetectionStep.java:251)
	at org.sonar.server.computation.task.projectanalysis.filemove.FileMoveDetectionStep.execute(FileMoveDetectionStep.java:136)
	at org.sonar.server.computation.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64)
	at org.sonar.server.computation.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52)
	at org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:73)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.executeTask(CeWorkerImpl.java:134)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:97)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$$Lambda$743/354513100.get(Unknown Source)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.withCustomizedThreadName(CeWorkerImpl.java:81)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:73)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:43)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

I get exactly the same error.
SonarQube 6.7.6
Plugins:

  • Android* 1.1 installed * *
  • Checkstyle * 2.4 installed * *
  • Dependency-Check * 1.1.1 installed * *
  • Findbugs * 3.3 installed * *
  • Git * 1.8 (build 1574) installed * *
  • GitHub * 1.4.2 (build 1027) installed * *
  • Gosu * 1.0-SNAPSHOT installed * *
  • PMD* 2.5 installed * *
  • SonarCSS * 1.0.3 (build 724) installed * *
  • SonarHTML * 3.1 (build 1615) installed * *
  • SonarJS* 5.1.1 (build 7506) installed * *
  • SonarJava* 5.8 (build 15699) installed * *
  • SonarPHP* 3.0.0.4537 installed * *
  • SonarTS* 1.9 (build 3766) installed * *
  • SonarXML * 2.0.1 (build 2020) installed

If we only analyse some classes, with the command “sonar.coverage.inclusions” it runs through the analyses. But the whole project do not work and it ends with this error above.

Hi,

It sounds like your server needs more memory allocated to the compute engine (that’s the .ce. in your stacktrace). Check the sonar.ce.* settings in $SONARQUBE_HOME/conf/sonar.properties.

 
Ann

1 Like

Hi Ann
Thank you for your answer.
Your solution works. I set “-Dsonar.ce.javaOpts=-Xmx2048m” and the error do not occur anymore.