Description:
when set the parameter "loadBalanceAutoCommitStatementThreshold=2" in jdbc url
, then the LoadBalancedAutoCommitInterceptor.java will be endless loop in 84~85 line (the version is 5.1.39)
for example:
BasicDataSource ds = new org.apache.commons.dbcp.BasicDataSource();
ds.setMaxActive(1);
ds.setMaxIdle(1);
ds.setMinIdle(1);
ds.setValidationQuery("select current_date");
ds.setInitialSize(1);
ds.setUsername("root");
ds.setPassword("......");
ds.setDriverClassName("com.mysql.jdbc.ReplicationDriver");
ds.setUrl("jdbc:mysql:replication://121.43.235.120:3306,114.215.201.204:3306,121.43.235.120:3306/manfenhomev4?useUnicode=true&characterEncoding=UTF-8&autoReconnect=false&loadBalanceStrategy=random&retriesAllDown=2&loadBalanceAutoCommitStatementThreshold=2&connectTimeout=10000&socketTimeout=20000&readFromMasterWhenNoSlaves=true&allowSlavesDownConnections=true&allowMasterDownConnections=true");
Connection connection = ds.getConnection();
This happens when getConnection();
How to repeat:
The Error Stack:
LoadBalancedAutoCommitInterceptor.postProcess(String, Statement, ResultSetInternalMethods, Connection, int, boolean, boolean, SQLException) line: 85
MysqlIO.invokeStatementInterceptorsPost(String, Statement, ResultSetInternalMethods, boolean, SQLException) line: 2878
MysqlIO.sqlQueryDirect(StatementImpl, String, String, Buffer, int, int, int, boolean, String, Field[]) line: 2801
JDBC4Connection(ConnectionImpl).execSQL(StatementImpl, String, int, Buffer, int, int, boolean, String, Field[], boolean) line: 2545
JDBC4Connection(ConnectionImpl).execSQL(StatementImpl, String, int, Buffer, int, int, boolean, String, Field[]) line: 2503
JDBC4LoadBalancedMySQLConnection(MultiHostMySQLConnection).execSQL(StatementImpl, String, int, Buffer, int, int, boolean, String, Field[]) line: 164
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 606
LoadBalancedConnectionProxy.invokeMore(Object, Method, Object[]) line: 492
LoadBalancedConnectionProxy(MultiHostConnectionProxy).invoke(Object, Method, Object[]) line: 452
$Proxy0.execSQL(StatementImpl, String, int, Buffer, int, int, boolean, String, Field[]) line: not available
JDBC4ReplicationMySQLConnection(MultiHostMySQLConnection).execSQL(StatementImpl, String, int, Buffer, int, int, boolean, String, Field[]) line: 164
StatementImpl.executeQuery(String) line: 1369
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 606
MultiHostConnectionProxy$JdbcInterfaceProxy.invoke(Object, Method, Object[]) line: 103
$Proxy2.executeQuery(String) line: not available
DelegatingStatement.executeQuery(String) line: 208
PoolableConnectionFactory.validateConnection(Connection) line: 658
BasicDataSource.validateConnectionFactory(PoolableConnectionFactory) line: 1558