[CONJ-884] MariaDbPoolDataSource leaks connections when the mariadb server restarts Created: 2021-05-17  Updated: 2021-07-27  Resolved: 2021-07-26

Status: Closed
Project: MariaDB Connector/J
Component/s: pooling
Affects Version/s: 2.4.4, 2.7.3
Fix Version/s: 2.7.4, 3.0.1-beta

Type: Bug Priority: Major
Reporter: Cart Antonin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None

Attachments: Java Source File MariaDbPoolDataSourceTest.java     Text File output_244.txt     Text File output_273.txt    

 Description   

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.

Thank you



 Comments   
Comment by Diego Dupin [ 2021-07-26 ]

thanks for clear report!

Generated at Thu Feb 08 03:19:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.