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

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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:

1 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 lessthan 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

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

Bamboo >= 7.2

1 <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.

1 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.

Updated on April 16, 2025

Still need help?

The Atlassian Community is here for you.