java - 了解 "APPARENT DEADLOCK!!! Complete Status"详细信息

标签 java c3p0

我在下面发布了一小部分日志,如果有人可以解码以下内容,我将非常感激:

  • 列出项目
  • 托管线程
  • Activity 线程
  • Activity 任务
  • 待处理任务
  • 池线程堆栈跟踪

我有以下 C3PO 配置:

c3p0.minPoolSize=10
c3p0.maxPoolSize=40
c3p0.acquireIncrement=5
c3p0.maxIdleTime=1800
c3p0.maxStatements=50
c3p0.idleConnectionTestPeriod=180

这是日志:

09-02@12:28:43 WARN  ThreadPoolAsynchronousRunner [Timer-0] - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@700ec336 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
09-02@12:28:43 WARN  ThreadPoolAsynchronousRunner [Timer-0] - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@700ec336 -- APPARENT DEADLOCK!!! Complete Status:
        Managed Threads: 3
        Active Threads: 3
        Active Tasks:
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@34ac7f2c (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@28d13cb8 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@40e968f7 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
        Pending Tasks:
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@1bea516c
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@348797c5
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@31fd2174
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@619f604f
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@266c149b
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@1bcdfd2
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@170a54e2
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@274acd3f
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@1fe8f740
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@77c09b1d
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@607ca57
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@697518d8
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@6b242ff
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@214c76c8
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@230a558c
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@7b766c4c
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@1bc030e7
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@66ca9bec
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@7fc2d7ac
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@50dd9ebb
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@5e03077
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@418dd7a4
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@4748719b
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@651a9bac
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@35e26d0f
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@24660f6c
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask@287e8e1f
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@ca4a9fe
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@e94692e
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@3185527c
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@27ea644a
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@d5e4abf
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@297d4874
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@601fccf3
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@47c896d2
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@4225d9cf
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@42fec6f6
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@64b862d6
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@5610343
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@241d2677
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@75c86126
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@36624233
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@6ce83e29
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@3492d9b
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@39511ccc
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@7c39b279
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StmtAcquireTask@2ff465a6
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@563d8de2
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@632e1ca9
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@685bce1d
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@63390771
                com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@3517be9b
Pool thread stack traces:
        Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
                com.mysql.jdbc.StatementImpl.close(StatementImpl.java:575)
                com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
                com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
        Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
                com.mysql.jdbc.StatementImpl.close(StatementImpl.java:575)
                com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
                com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
        Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
                com.mysql.jdbc.StatementImpl.close(StatementImpl.java:575)
                com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:41)
                com.mchange.v2.c3p0.stmt.GooGooStatementCache$1StatementCloseTask.run(GooGooStatementCache.java:404)
                com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

有关明显僵局的一些信息将不胜感激。

最佳答案

线程池包含3个线程。 (“托管线程”)。他们三个都很“活跃”,试图完成一项任务。 (“Activity 线程”),没有准备好承担工作的 hibernate 线程。任务已列出。它们都是缓存语句关闭任务。

当线程池中的所有任务长时间保持不变时,会触发明显死锁。 c3p0(实际上是它下面的线程池库)最终假设,如果池中没有任务成功完成,则池处于死锁状态。库中断()然后丢弃这些线程,并用新线程替换它们,以便其他任务(您有很长的任务积压,“待处理任务”)可以尝试运行。

就您而言,这个问题是众所周知的。如果某些 JDBC 驱动程序的父 Connection 正在使用,其 Statement.close() 操作可能会死锁。对于这些(形式上不符合规范)驱动程序,c3p0 实现了谨慎的 Statement 关闭策略,其中 Statement 销毁为 tasked asynchronously and only performed when the parent Connection is known not to be in use .

TL; DR:设置statementCacheNumDeferredCloseThreads到一。

c3p0.statementCacheNumDeferredCloseThreads=1

关于java - 了解 "APPARENT DEADLOCK!!! Complete Status"详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58283321/

相关文章:

java - 在 IntelliJ 中运行 Spring Boot 导致无法加载 'javax.el.ExpressionFactory'

java - 格式字符串变为 xxx1、xx10 或 1###、10## 等

mysql - C3P0 0.9.5-pre6 与 Jetty 9.1

java - hibernate/C3P0 : Server crashes after MySQL timeout

java - MySQL超时后c3p0连接抛出异常

java - 无论如何我可以在Big-O中制作这个方法O(1)吗?

java - 单击按钮时,android 在屏幕上显示文本。 xml+java的关系

java - 未能执行项目目标。项目中找不到POM

java - NewProxyPreparedStatement 实现了PreparedStatement,但没有履行契约?

hibernate - 从服务器成功接收到的最后一个数据包是在 109,253 毫秒前