Sonarqube 9.9 LTS IDLE conections issue

Make sure to tell us:

  • What version are you upgrading from? 8.9 LTS
  • System information (Operating system, Java version, Database provider/version)
  • Operating system : ubuntu 20.04
  • Java version : 17
  • Database provider : Google clould SQL postgress/15
    current sonarqube version : 9.9 LTS
  • What’s the issue you’re facing?

After the upgrade, I am unable to connect to database and getting the below error.

When I check the previous release notes, I could see the “sonar.jdbc.maxIdle” feature has been removed, can you please tell whether this could be the issue for this ?
I have checked all the sonarqube configurations and its same as default.
And I could see the IDLE connections in GCP-Cloud SQL Postgres 15 instance about 21. Please find the below screenshot.

Kindly sugesst the solution to fix this.

Hey there.

Can you try configuring the defaults listed here?

Am facing same kinda of issue on sonarqube 9.9 LTS version once sonaqube is up and running i could see sonarqube user are in idle status which occupy more connection slots which make issue to connect the postgre 15 DB
failed: FATAL: remaining connection slots are reserved for non-replication superuser connections
Adding below parameter on sonar config file could not able to fix the issue.

"sonar.jdbc.idleTimeout" = "600000"

"sonar.jdbc.keepaliveTime" = "300000"

"sonar.jdbc.maxLifetime" = "1800000"

"sonar.jdbc.validationTimeout" = "5000"
Any one suggestion solution on this. Thanks.

Hi colin,

Yes I tried configuring as per sonarqube docs,

“sonar.jdbc.idleTimeout” = “600000”

“sonar.jdbc.keepaliveTime” = “300000”

“sonar.jdbc.maxLifetime” = “1800000”

“sonar.jdbc.validationTimeout” = “5000”

still getting the same error…

I could not control this behaviour of idle connections as sonarqube_user.

so the new query raised by client is not accepting. Please confirm whether this is the default behaviour of sonarqube ?

Hello @vicky_spidy ,

You can specify minimum idle connections by using property sonar.jdbc.minIdle (default is 10), hence you are seeing 20 (10 from WEB process, and 10 from Compute Engine). You could try to lower it to 5 and see if that helps.

Moreover you can specific maximum size of the pool using sonar.jdbc.maxActive, default is 60. In your case you should definitely lower value of that property, so that it would never exceed the amount of available connections in your Postgres database.

Let me know if you have questions.

I tried with the same. I unable to control this idle connections using HikariCP settings as well,

sonar.jdbc.maxActive , etc.,

But its not working as well. I would like to know also, Why sonarqube version 9.9 LTS keeping this much idle connections also from the same user?
I could not find the default IDLE connections (number) in the sonarqube documentations.
IF i didn’t enbale any connection pool settings, what will be default values for the 9.9 LTS. Where i can find that.

@vicky_spidy ,

Why sonarqube version 9.9 LTS keeping this much idle connections also from the same user?

This is fundamental question for database connection pools. This component tries to minimise creation of new connection as this is costly process.

As I said, default number of maximum IDLE connection is equal to 10. Within SonarQube instance there are two processes which connects to a database (WEB process, and CE process). That means the total number of IDLE connections will be 20 as you have saw in your GCP web console.

After you have changed sonar.jdbc.minIdle=5, could you please enable DEBUG logging and share that log with me?

Ok Thank yor for the explaination on the default connection pool settings. It would be very helpfull for me if you have any documention (especially from Sonarqube )regarding this, so that I can share it with my collegues.

And sure I will enable debug logging and share it with you.