MySQL Too many connections error
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
Confluence server runs into issues due to the following errors in atlassian-confluence.logs
WARN [C3P0PooledConnectionPoolManager[identityToken->2rxoowa718mgiwy1hbhgv1|373cc023]-HelperThread-#0] [mchange.v2.resourcepool.BasicResourcePool] log com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@769977cc -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
.
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections
Environment
Confluence configured with MySQL database
Cause
This happens because MySQL database has maxed out its connection limit and can't accept any more connections from clients.
Solution
To avoid this issue, increase the maximum connection limit in MySQL server's configuration. Usually this is specified with the max_connections parameter in MySQL server configuration. A restart of MySQL will be required for these changes to take affect.