读超时为10分钟但是10秒就Socket read timed out了

Oracle数据库, 使用的是type: com.alibaba.druid.pool.DruidDataSource

显式配置了读取超时时间为10分钟:

connectionProperties: oracle.jdbc.ReadTimeout=600000

怎么10秒就报了下面的错了呢?

### Cause: java.sql.SQLRecoverableException: IO Error: Socket read timed out
194486 ; IO Error: Socket read timed out; nested exception is java.sql.SQLRecoverableException: IO Error: Socket read timed out
194487 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:254)
194488 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
194489 at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
194490 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
194491 at com.sun.proxy.$Proxy57.selectList(Unknown Source)
194492 at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
194493 at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:158)
194494 at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:76)
194495 at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:62)
194496 at com.sun.proxy.$Proxy61.pagingGetUpdateOrgUniCodeListFromOrgEsgScanctionRela(Unknown Source)

Caused by: java.sql.SQLRecoverableException: IO Error: Socket read timed out
194508 at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:932)
194509 at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:933)
194510 at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1082)
194511 at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)
194512 at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343)
194513 at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3887)
194514 at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1079)
194515 at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483)
194516 at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
194517 at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
194518 at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(MybatisSimpleExecutor.java:67)
194519 at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
194520 at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
194521 at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
194522 at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
194523 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
194524 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
194525 at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
194526 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
194527 at java.lang.reflect.Method.invoke(Method.java:498)
194528 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
194529 ... 16 common frames omitted
194530 Caused by: java.net.SocketTimeoutException: Socket read timed out
194531 at oracle.net.nt.TimeoutSocketChannel.read(TimeoutSocketChannel.java:174)
194532 at oracle.net.ns.NIOHeader.readHeaderBuffer(NIOHeader.java:82)
194533 at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:139)
194534 at oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:101)
194535 at oracle.net.ns.NIONSDataChannel.readDataFromSocketChannel(NIONSDataChannel.java:80)
194536 at oracle.jdbc.driver.T4CMAREngineNIO.prepareForReading(T4CMAREngineNIO.java:98)
194537 at oracle.jdbc.driver.T4CMAREngineNIO.unmarshalUB1(T4CMAREngineNIO.java:534)
194538 at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:485)
194539 at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
194540 at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)
194541 at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226)
194542 at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59)
194543 at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:910)
194544 ... 36 common frames omitted

回答

10秒还没读完,啥业务?

定时任务 每天对昨天变动的数据跑一下 没有索引 所以会慢一点

看一下参数是不是设置成功了。

有反编译工具的话看一下源码,设置逻辑。

回复
@zgw06629 : 1.看一下源码默认超时配置, 2.确认一下oracle 有没有配置,输出超时的逻辑即使没有设置成功 也不会是默认10秒读超时吧