Unable to generate the sonarreports,Backgroundtaskfailedwithjava.lang.OutOfMemoryError:Javaheapspace

9.8 community version is using, able to produce reports for 4 applications, for one application getting this issue due to files size is more.Please guide me to solve this issue.
Size of the files:
INFO: Analysis report generated in 16146ms, dir size=361.2 MB
INFO: Analysis report compressed in 62968ms, zip size=167.4 MB

Issue:Error Details
java.lang.OutOfMemoryError: Java heap space
	at org.postgresql.util.PGbytea.toBytesHexEscaped(PGbytea.java:57)
	at org.postgresql.util.PGbytea.toBytes(PGbytea.java:50)
	at org.postgresql.jdbc.PgResultSet.getBytes(PgResultSet.java:2713)
	at org.postgresql.jdbc.PgResultSet.getBinaryStream(PgResultSet.java:2787)
	at com.zaxxer.hikari.pool.HikariProxyResultSet.getBinaryStream(HikariProxyResultSet.java)
	at org.sonar.db.ce.CeTaskInputDao.selectData(CeTaskInputDao.java:69)
	at org.sonar.ce.task.projectanalysis.step.ExtractReportStep.execute(ExtractReportStep.java:67)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:79)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:70)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:57)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:212)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:194)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:160)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$$Lambda$400/0x0000000100482470.apply(Unknown Source)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:135)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:87)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Tried to add

export SONAR_SCANNER_OPTS=-Xmx1024m in jenkins pipeline

Add these in sonar properties files

#sonar.web.javaOpts=-Xmx1024m -Xms512m -XX:+HeapDumpOnOutOfMemoryError
sonar.ce.javaOpts=-Xmx12g -Xms3g -XX:+HeapDumpOnOutOfMemoryError


Welcome to the community!

Is that the full stacktrace? And can we have the last few lines before the error?


Hi Ann,

Thanks for your reply, this is the full stracktrace. Please find the attached screenshot.

When i tried with exclusion of some files it was working fine whereas i need to include these files as well in scan report.

  • sonar.exclusions=**/lib/*.php,**/lib/*.js,**/mod/*.php

File sizes while excluded the files as follows
INFO: Analysis report generated in 15557ms, dir size=345.5 MB
INFO: Analysis report compressed in 47376ms, zip size=161.2 MB

Please help me with this.


I suggest you try bumping up the server memory allocations some more.

Also, it’s not clear to me why you would want to analyze library code. (I assume that’s what’s in /lib/…?)


Hi Ann,

Could you please elaborate which server memory allocation need to increase and is it from hardware side or do we need to add values in any properties files?

do we need to upgrade both sonarqube server and scanner servers or just sonarqube server, as the analysis has failed at sonarqube server end but not at sonar-scanner end.

We need to analyze librbary code as well as it is requirement from Dev team.




Sorry. You cited sonar.ce.javaOpts above. That’s the one.

Looking back, though I see you’ve got two different sonar.ce.javaOpts lines? Those aren’t additive. The 2nd one is replacing the first. Consolidate them into one line, bump up the allocation and try again, please.


Tried with single one and used ```
sonar.ce.javaOpts=-Xmx2g -Xms3g -XX:+HeapDumpOnOutOfMemoryError

Is it possible take a call to fix this issue


You don’t need to quote that line.

What was the outcome? Same error?


Hi Ann,

Same error after adding with single line, even tried to pass these values directly from Jenkins pipeline script as below
-Dsonar.web.javaOpts=-Xmx2g -Dsonar.ce.javaOpts=-Xmx2g

same error is triggereing.



Those properties affect the memory allocated to the server at startup. Passing them in analysis won’t have any effect.

What did you allocate in sonar.properties?

Also, I just noticed that you’re still on SonarQube 9.8.

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

9.8 → 9.9 → 10.1 (last step optional)

Can you try that and see if the error persists? Because the next step would be to ask the developers to take a look. But I can’t do that while you’re on an EOL version.


Hi Ann,

Aplogies i am in current LTS version * Community Edition

  • Version 9.9.1, Still got the error.
    in sonar.properties allocated below values.

sonar.ce.javaOpts=-Xmx4g -Xms3g -XX:+HeapDumpOnOutOfMemoryError
sonar.web.javaOpts=-Xmx4g -XX:MaxPermSize=4g -XX:ReservedCodeCacheSize=128m
sonar.search.javaOpts=-Xmx4g -Xms4g -XX:MaxDirectMemorySize=4g -XX:+HeapDumpOnOutOfMemoryError

please find the attached screenshot.

Please do the needful to fix this issue.


1 Like

Hi Ann,

Colud please help me to fix this issue, we need it bit urgent.


Hi Team,

Kindly consider this issue and please share the solution for this issue, as we have stuck in middle for sonar qube reports.

Hi Ann/Team,

Could you please suggest the solution for it.



I’ve flagged this for more expert eyes. In the meantime, you can try progressively increasing the memory allocation - in sonar.properties for the process that’s failing.


Hi Team,

Can we any one look into this issue.

Hi Team/Ann,

Could you please help me to fix this issue

Hi, did you try to progressively increase the memory allocated to the Compute Engine with sonar.ce.javaOpts in the server conf/sonar.properties file and a restart of SonarQube?

How much memory are you actually allocating to the compute engine? Could you please extract the system info file, and share with us the “Compute Engine JVM state” section, so that we can validate together that the memory is effectively allocated?


Could you please guide me how to get the system info file.Please provide the steps to get the logs.

Sure, it’s documented right here.