Bug #7952 Infinite recursion when trying to use failed-over connection
Submitted: 17 Jan 2005 12:27 Modified: 17 Jan 2005 20:30
Reporter: Uri Bernstein
Status: Closed
Category:Connector/J Severity:S1 (Critical)
Version:3.1.6 OS:
Assigned to: Target Version:

[17 Jan 2005 12:27] Uri Bernstein
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
[17 Jan 2005 20:30] Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html
[17 Jan 2005 20:31] Mark Matthews
This is fixed for version 3.1.7. You can test with a nightly build from
http://downloads.mysql.com/snapshots.php after 00:00 GMT Jan 18th.