Description:
I ran into a infinite recursion when trying to use a connection which was failed-over, when shouldFallBack() returns true.
It appears that when attempting to re-establish the connection, the code attempts to execute an SQL, which leads to yet another attempt to re-establish the connection, etc.
Here's the relevant part of the stack trace:
[etc.]
at com.mysql.jdbc.Connection.execSQL(Connection.java:2258)
at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2912)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3138)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1833)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2258)
at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2912)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3138)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1833)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2258)
at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2912)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3138)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1833)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2258)
at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2912)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3138)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1833)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2258)
at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2912)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3138)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1833)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2258)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2226)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1159)
at com.mysql.jdbc.Connection.getTransactionIsolation(Connection.java:792)
How to repeat:
1. Use a connection with failover enabled.
2. Take down the "master" DB (first on the host list in the URL)
3. Wait for the amount of time specified in secondsBeforeRetryMaster
4. Try to execute an SQL
5. Wait forever