# SonarQube + postgresql: invalid memory alloc request size

**URL:** <https://community.sonarsource.com/t/sonarqube-postgresql-invalid-memory-alloc-request-size/16581>\
**Category:** SonarQube Server / Community Build\
**Created:** [November 13, 2019, 11:34am UTC](https://community.sonarsource.com/t/sonarqube-postgresql-invalid-memory-alloc-request-size/16581 "2019-11-13T11:34:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carlo\_Mart](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carlo_mart/32/7415_2.png) [@Carlo\_Mart](https://community.sonarsource.com/u/Carlo_Mart)\
**Post date:** [November 13, 2019, 11:34am UTC](https://community.sonarsource.com/t/sonarqube-postgresql-invalid-memory-alloc-request-size/16581/1 "2019-11-13T11:34:50Z")

</div>

Hi  
I’ve scan with sonar-scan (Version 4.2.0.1873-linux) a very large java application and it has finished correctly, but the background task on SonarQube (Versione 8.0.0.29455), show me this error:

> Blockquote  
> Error Details  
> java.lang.IllegalStateException: Fail to select data of CE task AW5caAgKPYjamDYGVnEh  
> at org.sonar.db.ce.CeTaskInputDao.selectData(CeTaskInputDao.java:74)  
> at org.sonar.ce.task.projectanalysis.step.ExtractReportStep.execute(ExtractReportStep.java:65)  
> 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$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(FutureTask.java:264)  
> at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)  
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)  
> at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)  
> at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)  
> at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)  
> at java.base/java.lang.Thread.run(Thread.java:834)  
> Caused by: org.postgresql.util.PSQLException: ERRORE: invalid memory alloc request size 1402166673  
> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)  
> at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)  
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)  
> at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)  
> at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)  
> at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143)  
> at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:106)  
> at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)  
> at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)  
> at org.sonar.db.ce.CeTaskInputDao.selectData(CeTaskInputDao.java:67)  
> … 18 more

I’ve installed SonarQube on a Centos 8 OS with postgresql 10.6.

can someone help me?

Thanks  
Carlo

---

<div class="post-metadata">

**Author:** ![Carlo\_Mart](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carlo_mart/32/7415_2.png) [@Carlo\_Mart](https://community.sonarsource.com/u/Carlo_Mart)\
**Post date:** [November 15, 2019, 9:43am UTC](https://community.sonarsource.com/t/sonarqube-postgresql-invalid-memory-alloc-request-size/16581/3 "2019-11-15T09:43:48Z")

</div>

The problem exist because the report scan is bigger than 1GB and the field size limits in postgresql is 1GB(the logical size of any value of a TOAST-able data type to 1 GB, [https://www.postgresql.org/docs/10/storage-toast.html](https://www.postgresql.org/docs/10/storage-toast.html)).  
I can’t understand why sonarqube stores the entire report into the database.

---

<div class="post-metadata">

**Author:** ![Carlo\_Mart](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carlo_mart/32/7415_2.png) [@Carlo\_Mart](https://community.sonarsource.com/u/Carlo_Mart)\
**Post date:** [November 15, 2019, 10:24am UTC](https://community.sonarsource.com/t/sonarqube-postgresql-invalid-memory-alloc-request-size/16581/4 "2019-11-15T10:24:26Z")

</div>

Could be better use Large Objects type ([https://www.postgresql.org/docs/10/largeobjects.html](https://www.postgresql.org/docs/10/largeobjects.html)) vs bytea.

---

<div class="post-metadata">

**Author:** ![sns-seb](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/sns-seb/32/4520_2.png) [@sns-seb](https://community.sonarsource.com/u/sns-seb)\
**Post date:** [November 15, 2019, 1:14pm UTC](https://community.sonarsource.com/t/sonarqube-postgresql-invalid-memory-alloc-request-size/16581/5 "2019-11-15T13:14:32Z")

</div>

Hello Carlo,

You can challenge the fact that the report is stored and/or that the supported size is limited to 1Gb on Postgres.

However, in your position, I would first wonder whether it is any good to the performance of the analysis (during scanner run, network transfert, asynchronous processing, …) to have a 1Gb report produced in the first place.

Sources are compressed in the report and analysis data is stored in a size optimized binary format (that roughly the content of the report).

I’m wondering whether the report may be bundling files it shouldn’t.

You could directly impact the size of the report by excluding files from analysis which are actually non meaningful and double check the configuration of source directories (see this [doc](https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/)).

Cheers,

---

<div class="post-metadata">

**Author:** ![Satheesh\_Prabhakaran](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/satheesh_prabhakaran/32/15558_2.png) [@Satheesh\_Prabhakaran](https://community.sonarsource.com/u/Satheesh_Prabhakaran)\
**Post date:** [September 28, 2020, 5:19am UTC](https://community.sonarsource.com/t/sonarqube-postgresql-invalid-memory-alloc-request-size/16581/6 "2020-09-28T05:19:50Z")

</div>

Hi All,

Can you let me know how to fix this issue in Centos 7.8 based postgresql and Sonarqube installation. We cant exclude any files so size of report is higher than 1GB. Please help in increasing size of postgresql size limitation.

---

<div class="post-metadata">

**Author:** ![zservati](https://avatars.discourse-cdn.com/v4/letter/z/e19adc/32.png) [@zservati](https://community.sonarsource.com/u/zservati)\
**Post date:** [February 22, 2022, 9:53pm UTC](https://community.sonarsource.com/t/sonarqube-postgresql-invalid-memory-alloc-request-size/16581/7 "2022-02-22T21:53:12Z")

</div>

I excluded some of the xml files and my report size now it 2G, I am able to see the analysis results, but I am still seeing a failed task created.  
Here is the stack trace:

[heapsize.txt](https://community.sonarsource.com/uploads/short-url/dwEUOkRbwE5zGlw81O20cT229lo.txt) (2.9 KB)
