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
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
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.
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
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.
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, 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?