HikariCP try-with-resources 连接泄漏

我正在做一些需要从 MariaDB 中提取数据(使用 HikariCP),然后通过 Redis 发送的工作。最终,当我尝试从数据库中提取时,连接将开始泄漏。这只会随着时间的推移而突然发生。


这是泄漏开始发生时的完整日志:https : //hastebin.com/sekiximehe.makefile


这是一些调试信息:


21:04:40 [INFO] 21:04:40.680 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Before cleanup stats (total=6, active=2, idle=4, waiting=0)


21:04:40 [INFO] 21:04:40.680 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After cleanup  stats (total=6, active=2, idle=4, waiting=0)


21:04:40 [INFO] 21:04:40.682 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.mariadb.jdbc.MariaDbConnection@4b7a5e97


21:04:40 [INFO] 21:04:40.682 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After adding stats (total=7, active=2, idle=5, waiting=0)


21:05:05 [INFO] 21:05:05.323 [HikariPool-1 housekeeper] WARN  com.zaxxer.hikari.pool.ProxyLeakTask - Connection leak detection triggered for org.mariadb.jdbc.MariaDbConnection@52ede989 on thread Thread-272, stack trace follows

java.lang.Exception: Apparent connection leak detected

        at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:123)

        at us.survivewith.bungee.database.FetchPlayerInfo.run(FetchPlayerInfo.java:29)

        at java.lang.Thread.run(Thread.java:748)


21:05:10 [INFO] 21:05:10.681 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Before cleanup stats (total=7, active=2, idle=5, waiting=0)


21:05:10 [INFO] 21:05:10.681 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After cleanup  stats (total=7, active=2, idle=5, waiting=0)

慕雪6442864
浏览 553回答 2
2回答

HUX布斯

Jedis也是JedisPool的一个你应该关闭的资源: /// Jedis implements Closeable. Hence, the jedis instance will be auto-closed after the last statement. try (Jedis jedis = pool.getResource()) {
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python