Menu

#7 APPARENT DEADLOCK!!

closed
nobody
None
5
2006-09-07
2005-04-22
jfjimenezp
No

I'm developing an application using Oracle 8.1.7, Sun
One Studio 5 and Hibernate 2.1.8 and c3p0-0.8.4.5.jar

While running the application I get the following error

com.mchange.v2.async.ThreadPoolAsynchronousRunne
r$DeadlockDetector@5acf13 -- APPARENT
DEADLOCK!!

The properties included in the hibernate.properties file
are :

hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=300
hibernate.c3p0.max_statements=50
hibernate.c3p0.idle_test_period=3000
hibernate.c3p0.acquire_increment=2
hibernate.c3p0.validate=false

What is the cause?

Thanks.

Discussion

  • Daniel Edberg

    Daniel Edberg - 2005-04-29

    Logged In: YES
    user_id=1269101

    Hi,
    I'm dealing with exactly the same problem. I use
    c3p0-0.8.4.5, Hibernate3, mssql2000 and oracle 9.2i

    the deadlock seems to occur under inactivity when the system
    is idle for some time (couple of hours).. I havn't been able
    to recreate the deadlock exactly when I want though

    theese are my properties for c3p0:
    hibernate.c3p0.max_size = 5
    hibernate.c3p0.min_size = 2
    hibernate.c3p0.timeout = 1800
    hibernate.c3p0.max_statements = 100

    this is a stacktrace of the deadlocking threads:

    JProbe: Found Deadlock 1 (2 threads)
    Thread
    "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2"
    (ID: 0x1a4acc10) blocked by thread
    "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1"
    (ID: 0x19147e28) at:
    boolean
    com.mchange.v1.db.sql.StatementUtils.attemptClose(java.sql.Statement)
    void com.mchange.v2.c3p0.stmt.GooGooStatementCache$1.run()
    void java.lang.Runnable.run()
    void
    com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run()
    Thread
    "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1"
    (ID: 0x19147e28) blocked by thread
    "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2"
    (ID: 0x1a4acc10) at:
    void java.sql.Connection.close()
    void
    com.mchange.v2.c3p0.impl.C3P0PooledConnection.close(boolean)
    void com.mchange.v2.c3p0.impl.C3P0PooledConnection.close()
    void javax.sql.PooledConnection.close()
    void
    com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.destroyResource(java.lang.Object)
    void
    com.mchange.v2.resourcepool.ResourcePool$Manager.destroyResource(java.lang.Object)
    void com.mchange.v2.resourcepool.BasicResourcePool$5.run()
    void java.lang.Runnable.run()
    void
    com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run()

    in seriously need of a fix.. have you tried to find the
    root of the deadlock problem?

    Regards / Daniel Edberg

     
  • Nobody/Anonymous

    Logged In: NO

    I posted the same question to by Steve Waldman
    <swaldman@mchange.com>, I think he belongs to the
    developer's team, and he recommend me to upgrade to c3p0-
    0.9.0-pre5 and that's what I did.

    This versin has a better performace but although from time
    to time appears the same trace, mainly when the application
    is idle, the application doesn't hang anymore.

    That's all for now.
    I hope this helps you.

     
  • Steve Waldman

    Steve Waldman - 2005-05-11

    Logged In: YES
    user_id=175530

    Hi. Please give c3p0-0.9.0-pre6 a shot. I think it may resolve this issue. (If
    I understand the problem correctly, some drivers, most notably Oracle,
    deadlocked if Connections and their child Statements are concurrently and
    simultaneously closed. c3p0 now ensures that cached
    PreparedStatements closes are complete prior to calling Connection close.
    Note that other drivers threw intermittent NullPointerExceptions under the
    same or similar conditions, and these should also be fixed.)

    I would appreciate feedback as to whether this fix actually works for y'all,
    as this is not a problem I can replicate on my own. Thanks!

     
  • Nobody/Anonymous

    Logged In: NO

    Hi,
    I encountered the same problem.
    I'm using:
    c3p0 0.0.9 pre 6
    Hibernate 2.1.7 - JBoss 3.2.6 - JTDS 1.1 - SQL Server 7.0

    Here is the trace if it can help:

    15:56:15,092 WARN [ThreadPoolAsynchronousRunner]
    com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@12b
    23ce -- APPARENT DEADLOCK!!! Complete Status:
    [num_managed_threads: 3, num_active: 3; activeTasks:
    com.mchange.v2.resour
    cepool.BasicResourcePool$5@1e69671
    (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0),
    com.mchange.v2.res
    ourcepool.BasicResourcePool$5@19f0c0e
    (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2),
    com.mchange.v2.
    resourcepool.BasicResourcePool$5@d0a462
    (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1);
    pendingTasks:
    com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1d837fe,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@4415
    07, com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@1c09545,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@87fa6d, com
    .mchange.v2.c3p0.stmt.GooGooStatementCache$2@14a1bd1,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@683d27,
    com.mchang
    e.v2.c3p0.stmt.GooGooStatementCache$2@1870b40,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@f3a6eb,
    com.mchange.v2.c3
    p0.stmt.GooGooStatementCache$2@53bcf3,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@19a0f55,
    com.mchange.v2.c3p0.stmt
    .GooGooStatementCache$2@164a18e,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@1aa735f]

    Regards,
    Guillaume Chevallier

     
  • Nobody/Anonymous

    Logged In: NO

    from gchevallier@rsa.fr

    Hi,
    I'm dealing with the same problem.
    I'm using c3p0 0.0.9 pre 6 with:
    Hibernate 2.1.7, JBoss 3.2.6, jtds 1.1, SQL Server 7.0

    Here is the trace if it can help:
    15:56:15,092 WARN [ThreadPoolAsynchronousRunner]
    com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@12b
    23ce -- APPARENT DEADLOCK!!! Complete Status:
    [num_managed_threads: 3, num_active: 3; activeTasks:
    com.mchange.v2.resour
    cepool.BasicResourcePool$5@1e69671
    (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0),
    com.mchange.v2.res
    ourcepool.BasicResourcePool$5@19f0c0e
    (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2),
    com.mchange.v2.
    resourcepool.BasicResourcePool$5@d0a462
    (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1);
    pendingTasks:
    com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1d837fe,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@4415
    07, com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@1c09545,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@87fa6d, com
    .mchange.v2.c3p0.stmt.GooGooStatementCache$2@14a1bd1,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@683d27,
    com.mchang
    e.v2.c3p0.stmt.GooGooStatementCache$2@1870b40,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@f3a6eb,
    com.mchange.v2.c3
    p0.stmt.GooGooStatementCache$2@53bcf3,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@19a0f55,
    com.mchange.v2.c3p0.stmt
    .GooGooStatementCache$2@164a18e,
    com.mchange.v2.c3p0.stmt.GooGooStatementCache$2@1aa735f]

    Regards,
    Guillaume Chevallier <gchevallier@rsa.fr>

     
  • Venkat

    Venkat - 2005-07-12

    Logged In: YES
    user_id=1305529

    Hi Steve,

    Howdy. I still get this same warning about deadlock with
    MYSql DB and pool config below.

    minPoolSize = 50
    maxPoolSize =100
    acquireIncrement = 5

    Rest are defaults.

    Any idea is greatly appreciated.

    Thanks,
    Venkatesh

     
  • Jeetendra Mirchandani

    Logged In: YES
    user_id=877396

    I use c3p0 0.9.0.2 with mysql and am facing the same problem.
    Any clues?

     
  • Steve Waldman

    Steve Waldman - 2005-12-22

    Logged In: YES
    user_id=175530

    Hi.

    Can you get a thread dump from a VM after (preferably soon after) you see this
    message? Also, please include the active and pending tasks lists that get
    dumped with this message. Thanks!

    And sorry to all for a long absence!

     
  • Steve Waldman

    Steve Waldman - 2006-09-07
    • status: open --> closed
     
  • Steve Waldman

    Steve Waldman - 2006-09-07

    Logged In: YES
    user_id=175530

    Hi. I think, at long last, this problem is finally fixed.
    Daniel Edberg's jprobe stack trace points directly to the
    problem. Unfortunately, somehow I missed that, and let a
    year go by before finding this same deadlock myself. Thank
    you Daniel for the excellent sleuthing, and sorry it has
    been the fix has been so long in coming. If any users who've
    experience the APPARENT DEADLOCK issues can try out
    c3p0-0.9.1-pre7 and let me know whether they seem to be
    resolved, I'd appreciate that.

     

Log in to post a comment.