Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
None
-
None
Description
When using High Availability mode (e.g., loadbalance, replication), the system automatically attempts to reconnect when an existing connection fails. However, a problem occurs when this reconnection attempt fails.
Specific Problem
After a failed reconnection, the connection enters an invalid state where connection.rollback() or connection.commit() operations throw a NullPointerException:
java.lang.NullPointerException: Cannot invoke "org.mariadb.jdbc.client.Client.getContext()" because "this.currentClient" is null |
Expected Behavior
When a connection throws an SQLNonTransientConnectionException, the connection should no longer be usable. Any command must now throw an SQLException.
For example connection pools (like Apache Pool) might still attempt to perform rollback operations on these invalid connections silently catching the SQLException if there is any issue. This is a problem because in this state, connector would throw an SQLException, but in our case, it throw an NPE.
Required Fix
The connector must ensure that any command execution after failing reconnection either:
Succeeds completely, or
Throws a proper SQLException