最近在系统长时间运行后,如果在Oracle后台,KILL了一个Session之后,由于系统还是在频繁使用连接,我把timeBetweenEvictionRunsMillis设置为10秒,但是好像还是不会把这种失效的链接从连接池中清除掉。还是会继续让业务调用,造成经常出现connection holder is null的错误,同时ExceptionSorter好像也没有把这种报错的连接抛弃掉,请问这个是否是druid的BUG?还是说我的配置哪里有问题呢?配置和错误信息如下: 配置如下:
<Resource
name="jdbc/XXXXX"
auth="Container"
factory="com.alibaba.druid.pool.DruidDataSourceFactory"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@X.X.X.X:1521:orcl"
username="USERNAME"
password="PASSWORD"
initialSize="20"
minIdle="0"
maxActive="100"
maxWait="1000"
removeabandoned="false"
removeabandonedtimeout="18000"
validationQuery="select 1 from dual"
testWhileIdle="true"
testOnBorrow="false"
testOnReturn="false"
timeBetweenEvictionRunsMillis="10000"
poolPreparedStatements="true"
maxOpenPreparedStatements="100"
filters="stat,log4j" />`
错误信息如下: SQL [SELECT CO1,CO2,CO3,CO4,CO5 FROM TABLE1 WHERE KEY1='111' order by CO1]; SQL state [null]; error code [0]; connection holder is null; nested exception is java.sql.SQLException: connection holder is null at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:406) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:455) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:463) at org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:494) ........ Caused by: java.sql.SQLException: ORA-00028: your session has been killed
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:966)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1062)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3445)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3051)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3049)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3049)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:167)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:494)
... 40 more