Description:
in fail-over mode with the parameter autoreconnect set a true, when master becomes available, the driver causes a StackOverflowError when the fail-back fonctionnality is based on secondsBeforeRetryMaster parameter
In the same manner, only on server 4.1.x, parameter queriesBeforeRetryMaster makes trouble if settled under 6
How to repeat:
set url to :
jdbc:mysql://master_host,slave_host/db_name?useServerPrepStmts=false&autoReconnect=true&queriesBeforeRetryMaster=10000&secondsBeforeRetryMaster=20&maxReconnects=1
start the test with master_host not avalaible then estalish connection to it and wait 20 seconds
Suggested fix:
in private method initializePropsFromServer add at first :
this.masterFailTimeMillis = System.currentTimeMillis();
this.queriesIssuedFailedOver = -10;
this method is called only when new connection is established, so fail-back variables should be invalidated elsewhere it causes a infinite loop when internal requests are made on new server