问题描述:运行一个多线程程序,在一两小时不用的情况下,再执行mybatis的sql会报错。重启应用后正常,但也不是个事情。

错误日志如下:

2020-02-13 04:22:22.395 [HikariPool-1 housekeeper] WARN  com.zaxxer.hikari.pool.HikariPool -HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=30m53s308ms122µs99ns).
2020-02-13 04:25:28.566 [AsyncResolver-bootstrap-executor-0] INFO  c.n.d.shared.resolver.aws.ConfigClusterResolver -Resolving eureka endpoints via configuration
2020-02-13 04:30:28.569 [AsyncResolver-bootstrap-executor-0] INFO  c.n.d.shared.resolver.aws.ConfigClusterResolver -Resolving eureka endpoints via configuration
2020-02-13 04:30:52.716 [SchedulerFactory_Worker-4] ERROR com.task.job.HttpJob -taskExpiredDao.updateFireTime(448,df-msgcenter-core)失败,原因:nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 925628ms.
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 925628ms.
2020-02-13 04:30:52.718 [SchedulerFactory_Worker-4] ERROR com.wanmei.df.task.job.HttpJob -

日志大概意思分析到为:

HikariPool  WARN 连接泄露,然后Error连接超时,应该是使用了无效的连接没有释放或出现错误,导致客户端再次获取时候连接不可用。

检查:

1、数据库连接是否配置正确

2、数据库连接池配置问题

3、网络问题

解决:

1、我的网络没问题,那么就修改完善数据库连接池配置,添加空闲连接超时释放和最大存活时间,目的是保证连接池资源。

aximum-pool-size: 10
connection-timeout: 30000
idle-timeout: 60000
max-lifetime: 120000

单位毫秒,注意:idel+timeout的时间+1s 不能超过max-lifetime的时间,否则会置零,导致配置失效。

2、但是我配置完连接池参数还是出错,仔细查看日志,原来是配置的驱动名出错。

原来的:driver-class-name: oracle.jdbc.driver.OracleDriver

新的,正确的:driver-class-name: oracle.jdbc.OracleDriver

在1,2都修改完成后,测试观察,已经一天没有出现错误了

【解决】HikariPool-1 - Connection is not available, request timed out / Thread starvation or clock leap相关推荐

  1. 数据库连接异常: HikariPool-1 - Connection is not available, request timed out after 30000ms.

    记一次生产环境数据库连接数导致的报错问题:Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConn ...

  2. Pg报错: HikariPool-1 - Connection is not available, request timed out after 30040ms.问题处理

    1. 问题背景 数据批量入库时,报错:HikariPool-1 - Connection is not available, request timed out after 30040ms. 2. 问 ...

  3. HikariPool-1 - Connection is not available, request timed out after 30000ms.

    HikariPool是号称史上最快的数据库连接池,而且目前来看确实是这样的,SpringBoot2.0也已经采用HikariCP作为默认连接池配置. 近期项目也将druid切成了HikariPool, ...

  4. Connection is not available, request timed out after xxxms. 超时异常 Hikari连接池配置说明

    ## 数据库配置 spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.driverClassName ...

  5. 轻松解决2013 lost connection to mysql server at ‘reading initial communication packet‘, system error: 0“

    ##轻松解决 2013 lost connection to mysql server at 'reading initial communication packet', system error: ...

  6. Xcode的SVN提示The request timed out.的解决方案

    问题描述 在利用Xcode的SourceControl进行SVN代码检出时,确认输入地址.帐号密码都正确的情况下,总是提示"The request timed out.".该问题的 ...

  7. 解决Openresty + lua:lua tcp socket read timed out

    解决Openresty + lua:lua tcp socket read timed out 问题描述 报错信息如下图所示: 对应的lua脚本: 一个是timeout还有一个事close失败了 解决 ...

  8. 解决报错Connection terminated as request was larger than 10485760

    报错场景: 当表单的中的内容相当多,提交时会报如下异常 Caused by: io.undertow.server.RequestTooBigException: UT000020: Connecti ...

  9. 解决莫名其妙出现connection closed的错误

    最近发现使用了springMVC的新项目偶尔出现connection closed,同事反映当访问同一个controller时经常出现类似错误 上回发现在使用 <context:componen ...

最新文章

  1. P4887 【模板】莫队二次离线(第十四分块(前体))
  2. 朋友,别在降低别人底线或被别人降低底线了!
  3. 安装HikVision(海康威视)网络摄像头
  4. Vs2010 MFC 简单制作过程中的问题
  5. 禁用Intel ME
  6. MySQL使用详解--根据个人学习总结
  7. UVA 1329——Corporative Network
  8. python如何使用字典_Python-如何使用点“。” 访问字典成员?
  9. Consider defining a bean of type ‘com.xg.stupro.service.StudentService‘ in your configuration.
  10. 笨办法学python3_软件测试需要学什么(个人软件测试学习路线)
  11. .Net开发人员通过WCF使用Node.js
  12. 区块链宠物社区Pawtocol与去中心化社交网络memeunity达成合作
  13. 任天堂的好日子還會繼續嗎﹖
  14. python列表去重函数_对python中两种列表元素去重函数性能的比较方法
  15. Linux云用户,Linux 用户与权限
  16. instantclient_11_2远程连接Oracle安装,绝对清晰易懂
  17. python数据分析与应用-Python数据分析与应用 PDF 内部全资料版
  18. HelloWorld的Java代码
  19. MathType编辑手写体
  20. Spark血缘字段解析

热门文章

  1. 前后端分离开发的优缺点
  2. Windows内使用Tomcat新建虚拟主机,并使用telnet访问
  3. 安装部署telnet服务
  4. 2023年易派客工业品展圆满落幕 期待与您再次相遇
  5. PHP重定向的三种方法
  6. vue token过期后自动刷新token
  7. 通信原理绪论测试题·
  8. Hbase面试题(面经)整理
  9. 未检测到Java SDK 环境-Java环境变量设置-Java开发环境搭建
  10. 在Ubuntu下重装Ubuntu