When an active MariaDbConnection fails (e.g. mariadb server restarts), the MariaDbPoolDataSource does not decrement Pool.totalConnection.
Consequently Pool.getConnection() may fail thinking the pool is full.
I test with the MariaDB Connector/J versions 2.4.4 and 2.7.3
The error is slightly different between these two versions but the behavior is the same.
2.4.4: When the connection fails, executeQuery calls fireConnectionErrorOccured.
Unfortunately the connectionErrorOccurred decrements Pool.totalConnection only if the connection is already in the idleConnections queue
2.7.3: MariaDbConnection.close() tries to rollback the transaction but it fails and throws an exception.
The connectionErrorOccurred method is never called.
See MariaDbPoolDataSourceTest.java and output_***.txt to reproduce the issue.