求教各位大佬!
使用impala-jdbc41+druid+mybatis查询impala数据,将druid由1.0.31升级到1.1.10,druid报连接关闭失败,连接已经关闭的error。
可能相关的问题: #2861 , #2628
现象:
项目初始化后,连接池初始化成功,查询成功。半个小时后,出现连接关闭失败的错误!随后隔较长一段时间(10-20分钟,后者更长时间)后,查询impala报连接关闭失败,随后查询成功!
随后将druid版本回退到1.0.31,经过多次测试,未出现此error!
具体错误信息如下:
2018-11-09 16:56:23,297 2685736 ERROR [http-nio-8809-exec-8] com.alibaba.druid.util.JdbcUtils - close connection error
java.sql.SQLNonTransientConnectionException: [Cloudera][JDBC](10060) Connection has been closed.
at com.cloudera.impala.exceptions.ExceptionConverter.toSQLException(Unknown Source)
at com.cloudera.impala.jdbc.common.SConnection.closeConnection(Unknown Source)
at com.cloudera.impala.jdbc.common.SConnection.abortInternal(Unknown Source)
at com.cloudera.impala.jdbc.common.SConnection.close(Unknown Source)
at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:186)
at com.alibaba.druid.filter.stat.StatFilter.connection_close(StatFilter.java:261)
at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:181)
at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.close(ConnectionProxyImpl.java:115)
at com.alibaba.druid.util.JdbcUtils.close(JdbcUtils.java:73)
at com.alibaba.druid.pool.DruidDataSource.discardConnection(DruidDataSource.java:1340)
at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1305)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5007)
at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:680)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5003)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1233)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1225)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:90)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82)
at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68)
at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:338)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
at com.sun.proxy.$Proxy130.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:83)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy137.queryCnt(Unknown Source)
其他组件版本如下:
impala-jdbc41 2.6.3.1004
mybatis-spring-boot-starter 1.3.2
druid-spring-boot-starter 1.1.10
druid配置如下:
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setDriverClassName(IMPALA_JDBC_DRIVER);
druidDataSource.setUrl(IMPALA_DB_URL);
druidDataSource.setMaxActive(20);
druidDataSource.setMinIdle(1);
druidDataSource.setMaxWait(10000);
druidDataSource.setInitialSize(3);
druidDataSource.setValidationQuery("select 1");
druidDataSource.setFilters("stat");
druidDataSource.setName("impala");
druidDataSource.setUseGlobalDataSourceStat(true);
return druidDataSource;
3条答案
按热度按时间i34xakig1#
我也遇到了相同的问题,这个问题有解决吗
ipakzgxi2#
没有解决,我是讲druid版本回退了。然后就没有出现这个问题了
6yoyoihd3#
同样的问题,有人解决了么?