minbox-projects / minbox-logging

分布式零侵入式、链路式请求日志分析框架。提供Admin端点进行采集日志、分析日志、日志告警通知、服务性能分析等。通过Admin Ui可查看实时链路日志信息、在线业务服务列表。
https://www.minbox.org/logging/
Apache License 2.0
60 stars 26 forks source link

数据库连接泄漏 #11

Open songjack opened 3 years ago

songjack commented 3 years ago

2021-08-19 14:03:17.560 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.ProxyLeakTask: 84 run - Connection leak detection triggered for com.mysql.jdbc.JDBC4Connection@3efea811 on thread SimpleAsyncTaskExecutor-1452, stack trace followsjava.lang.Exception: Apparent connection leak detected at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128) at com.zaxxer.hikari.HikariDataSource$$FastClassBySpringCGLIB$$eeb1ae86.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) at com.zaxxer.hikari.HikariDataSource$$EnhancerBySpringCGLIB$$6dfea906.getConnection() at org.minbox.framework.logging.admin.storage.LoggingDataSourceStorage.getConnection(LoggingDataSourceStorage.java:308) at org.minbox.framework.logging.admin.storage.LoggingDataSourceStorage.insertLog(LoggingDataSourceStorage.java:135) at org.minbox.framework.logging.admin.listener.ReportLogStorageListener.onApplicationEvent(ReportLogStorageListener.java:107) at sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.lang.Thread.run(Thread.java:745)

使用依赖如下:

org.minbox.framework api-boot-dependencies 2.1.6.RELEASE import pom
songjack commented 3 years ago

ps.executeUpdate();-------此行如果执行出错,数据库连接就释放不了,就会泄露 ps.close(); closeConnection(connection);