org.postgresql.util.PSQLException: FATAL: sorry, too many clients already error in Bamboo

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Bamboo records an error in $BAMBOO_HOME/logs/atlassian-bamboo.log  when trying to connect to a Postgres database:

org.postgresql.util.PSQLException: FATAL: sorry, too many clients already

Environment

  • PostgreSQL 

Cause

Bamboo is requesting a higher number of connections from the database than it is able to provide. 

Solution

To correctly configure your Bamboo connection pool when talking to PostgreSQL (or any other database) the number of database connections requested by Bamboo must be less than the maximum number of connections (max_connections) configured on the database side (including overhead for superuser_reserved_connections)

Bamboo:   

Locate your $BAMBOO_HOME/bamboo.cfg.xml file and look for the line :

Bamboo < 7.2

<property name="hibernate.c3p0.max_size>100</property>

Bamboo >= 7.2

<property name="hibernate.hikari.maximumPoolSize">100</property>

By default this will be set to 100.  This is generally a sensible default with little reason to change it unless its a very large Bamboo instance with lots of HTTP requests that are slow to serve.

In general this should be higher than the number of Tomcat HTTP threads (maxThreads) configured in $BAMBOO_INSTALL/conf/server.xml 


PostgresSQL:

Run the SQL command to check the amount of connections or PostgreSQL server is configured for.

show max_connections;

If it's less than what you have Bamboo requesting above you will need to increase it:

  1. Locate your postgresql.conf file  (You can run "SHOW config_file" in Postgres to locate it).
  2. Increase the max_connections value to more than the number that Bamboo is configured for. 

 This value should be HIGHER than the value set in bamboo.cfg.xml above. If you have an unreasonably large amount of connections configured on the Bamboo side (e.g. >100) you may also consider decreasing it on the Bamboo side instead.

Last modified on May 24, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.