数据库获取链接超时解决

项目上线后遇到系统频繁宕机问题,主要表现为每小时左右获取数据库链接超时。日志显示DruidDataSource获取连接超时,尝试修改源码后问题依旧。最终排查发现是服务器DNS配置问题导致的延迟,调整服务器DNS设置后,问题得到解决,系统运行稳定。
摘要由CSDN通过智能技术生成

项目上线后 ,系统每运行一个小时左右就宕机了。提示获取数据库链接超时。


2021-01-06 21:25:56.991 DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Creating new transaction with name [com.minstone.instance.api.api.WorkApiImpl.getWorkFlowCountByType]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
[2800] namenullstart create connection by thread:poolingCount=0notEmptyWaitThreadCount1url = jdbc:oracle:thin:@//172.18.201.50:1521/lzmis
[1651] 开始创建数据库连接 url =jdbc:oracle:thin:@//172.18.201.50:1521/lzmisdatasource id = 77 getProxyFilters().size() = 0
2021-01-06 21:25:57.001 WARN  com.alibaba.druid.pool.DruidDataSource - get connection timeout retry : 1
2021-01-06 21:25:57.011 ERROR com.alibaba.dubbo.rpc.filter.ExceptionFilter -  [DUBBO] Got unchecked and undeclared exception which called by 172.18.18.30. service: com.minstone.instance.api.service.IWorkApi, method: getWorkFlowCountByType, exception: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 10, active 1, maxActive 1000, creating 1, createElapseMillis 20, dubbo version: 2.5.8, current host: 192.168.122.1
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 10, active 1, maxActive 1000, creating 1, createElapseMillis 20
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:245)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:430)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:276)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:47)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

后面修改druid源码,获取链接用了几十秒,都卡住了。

最后发现是服务器dns配置导致的,修改服务器dns ,问题解决了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值