一次线上故障问题定位和解决

来源:互联网 发布:sql数据库开发 编辑:程序博客网 时间:2024/03/29 15:27

状况:

    系统在2017年9月27日13:42分左右开始,数据库connection被爆掉,资源耗尽,其中

1)log4j:一种是com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure,另外一种Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object


查看数据库只读库,压力并不大,但是有大量正在运行中的sleep连接

2)tomcat的catatina.out日志:

27-Sep-2017 13:52:48.500 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@2ec9908f]) and a value of type [io.netty.util.internal.InternalThreadLocalMap] (value [io.netty.util.internal.InternalThreadLocalMap@27f4cbe8]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

这种日志疯狂爆掉


判断:

1)用户请求耗时过长,没有释放申请的资源,包括db连接,同时也让线程资源耗尽;

2)对外依赖的接口,可能存在访问超时等情况。


结论:

经核查,其他项目组有发布新功能,正式我们使用的接口,导致timeout请求很多。同时,这些http接口的timeout设置,并不合理,所以导致资源耗尽。

原创粉丝点击