Too many connections error with mysql
-
I'm running FusionAuth with mysql 8.0.23.
When starting up FusionAuth, I get this error message in the logs, and it doesn't start correctly:
2021-05-06 7:02:20.664 AM INFO com.inversoft.jdbc.hikari.DataSourceProvider - Connecting to MySQL database at [jdbc:mysql://localhost:3306/fusionauth?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true] 2021-05-06 7:02:20.665 AM WARN com.zaxxer.hikari.HikariConfig - HikariPool-1 - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool. 2021-05-06 7:02:20.667 AM INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting... 2021-05-06 7:02:20.796 AM ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization. java.sql.SQLNonTransientConnectionException: Too many connections at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353)
mysql is running. When I log in and look at the active connections, I see this:
mysql> show status where variable_name = 'threads_connected'; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_connected | 152 | +-------------------+-------+
Any ideas?
-
I ended up restarting mysql which killed all those hanging connections.
I'm not sure why FusionAuth isn't releasing connections when it shuts down, but a restart resolved my issue.
-
And now it works fine with 152 threads connected, so unable to reproduce this.
I'll keep an eye out for this behavior and file an issue if it pops up again.
For the record:
FusionAuth 1.27
installed via zip file
Mysql 8.0.23 installed/managed via homebrew on the mac.