-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: C3po deadlock
PostPosted: Tue Jan 02, 2007 7:09 am 
Beginner
Beginner

Joined: Wed Aug 09, 2006 12:09 pm
Posts: 20
Location: Belgium
Hello. I am getting a deadlock on one of my applications. I am using Tomcat 5.5 with c3po for pooling.

I have found a couple of threads on this forum and have followed the advice of upgrading my c3po to version pre11 and setting my pooling config to c3p0.max_statements 0, but I still get the same deadlock errors (see stack trace below). I am now at my wits end any ideas of how I can sort this??

Thanks for reading.
cheers
Martin



Hibernate version:
hibernate 3

Mapping documents:
Code:
      <property name="connection.url">jdbc:mysql://server:3306/dbase?autoReconnect=true</property>
      <property name="connection.username">uname</property>
      <property name="connection.password">pass</property>

      <!-- configuration pool via c3p0-->
      
      <property name="c3p0.acquire_increment">1</property>
      <property name="c3p0.idle_test_period">100</property>
      <property name="c3p0.max_size">100</property>
      <property name="c3p0.max_statements_per_connection">0</property>
      <property name="c3p0.max_statements">0</property>
      <property name="c3p0.min_size">10</property>
      <property name="c3p0.timeout">100</property>



Full stack trace of any exception that occurs:
2007-01-02 11:47:20,765 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner] - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@917cb0 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2007-01-02 11:47:20,765 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner] - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@917cb0 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@c6b80e (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5dc268 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1866417 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1526e3
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@ac2d3c
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1cdc190
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@15ede11
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1455cf4
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@d9b071
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1ceebfa
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.lang.Thread.sleep(Native Method)
com.mysql.jdbc.Connection.createNewIO(Connection.java:2828)
com.mysql.jdbc.Connection.<init>(Connection.java:1531)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:978)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1774)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
java.lang.Thread.sleep(Native Method)
com.mysql.jdbc.Connection.createNewIO(Connection.java:2828)
com.mysql.jdbc.Connection.<init>(Connection.java:1531)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:978)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1774)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
java.lang.Thread.sleep(Native Method)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1769)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)


Top
 Profile  
 
 Post subject: c3po deadlock
PostPosted: Tue Jan 02, 2007 10:10 am 
Beginner
Beginner

Joined: Wed Aug 09, 2006 12:09 pm
Posts: 20
Location: Belgium
Anyone any idea? No Clues, hints or tips or pointers?

I am using MySQL 5.

Thanks for reading.

cheers
Martin


Top
 Profile  
 
 Post subject: ok I fixed it
PostPosted: Tue Jan 02, 2007 10:38 am 
Beginner
Beginner

Joined: Wed Aug 09, 2006 12:09 pm
Posts: 20
Location: Belgium
OK it seems the problem was tomcat, I added this to my startup line in the Tomcat configure manager in the startup panel and it all works fine

Code:
C:\Program Files\Java\jre1.5.0_07\bin\client\jvm.dll -Xmx128m -Xms128m -jar -Duser.dir="C:\Tomcat 5.5" C:\Tomcat 5.5\bin\bootstrap.jar


Top
 Profile  
 
 Post subject: Recomendation
PostPosted: Tue Jan 02, 2007 6:51 pm 
Newbie

Joined: Tue Apr 18, 2006 9:57 am
Posts: 18
Hi gurnard,


I recommend that use JDNI of tomcat server, really i probe c3p0 bad consume a lot of memory and is very us nestable, when i beginto use jndi tomcat pool manger my applications was better performance.

http://tomcat.apache.org/tomcat-5.0-doc ... howto.html


bye.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 2:57 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
gunard,

how is this startup different from the original default? the deadlocks you are seeing imply that Connection acquisition attempts were freezing (neither succeeding nor failing with an Exception). Had I seen your original query in time, I'd have suggested the configuration param c3p0.maxAdministrativeTaskTime (in a c3p0.properties file). But that's a kludgy workaround -- the best solution is to resolve the freeze on Connection acquisition. i'd like to understand how you did that, in case it comes up again.

thanks!

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 27, 2007 11:02 am 
Newbie

Joined: Tue Nov 23, 2004 4:33 pm
Posts: 6
I've seen this problem caused by faulty transaction handling. If you're not calling org.hibernate.Transaction.close() or org.hibernate.Transaction.rollback(), you may be leaking connections.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 23, 2008 6:20 am 
Newbie

Joined: Wed Jul 23, 2008 5:35 am
Posts: 2
Hi, I also see DEADLOCKs while my application working. It's very hard to understand the reasons of it also because it appears only in stress testing.
Here is my log
Code:
[2008-07-18 12:49:42,421]  WARN [Timer-0] (run@ThreadPoolAsynchronousRunner.java:608) - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@d43c3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
[2008-07-18 12:49:42,421]  WARN [Timer-0] (run@ThreadPoolAsynchronousRunner.java:624) - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@d43c3b -- APPARENT DEADLOCK!!! Complete Status:
   Managed Threads: 3
   Active Threads: 3
   Active Tasks:
      com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@52bc93 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
      com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask@1da7f11 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
      com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@1cc4259 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
   Pending Tasks:
      com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@1180e17
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@451a01
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@ae37ca
Pool thread stack traces:
   Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,4,main]
      java.io.FileInputStream.readBytes(Native Method)
      java.io.FileInputStream.read(FileInputStream.java:199)
      java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
      java.io.BufferedInputStream.read(BufferedInputStream.java:317)
      java.io.DataInputStream.readFully(DataInputStream.java:178)
      java.io.DataInputStream.readFully(DataInputStream.java:152)
      net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:826)
      net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:707)
      net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:466)
      net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:103)
      net.sourceforge.jtds.jdbc.ResponseStream.peek(ResponseStream.java:88)
      net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.java:3870)
      net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1042)
      net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:406)
      net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:696)
      net.sourceforge.jtds.jdbc.JtdsDatabaseMetaData.getTables(JtdsDatabaseMetaData.java:1823)
      com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnectionNoQuery(DefaultConnectionTester.java:185)
      com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:62)
      com.mchange.v2.c3p0.AbstractConnectionTester.activeCheckConnection(AbstractConnectionTester.java:67)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:368)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:310)
      com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:1999)
      com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
   Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,4,main]
      java.io.FileInputStream.readBytes(Native Method)
      java.io.FileInputStream.read(FileInputStream.java:199)
      java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
      java.io.BufferedInputStream.read(BufferedInputStream.java:317)
      java.io.DataInputStream.readFully(DataInputStream.java:178)
      java.io.DataInputStream.readFully(DataInputStream.java:152)
      net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:826)
      net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:707)
      net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:466)
      net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:103)
      net.sourceforge.jtds.jdbc.ResponseStream.peek(ResponseStream.java:88)
      net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.java:3870)
      net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1042)
      net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:406)
      net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:696)
      net.sourceforge.jtds.jdbc.JtdsDatabaseMetaData.getTables(JtdsDatabaseMetaData.java:1823)
      com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnectionNoQuery(DefaultConnectionTester.java:185)
      com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:62)
      com.mchange.v2.c3p0.AbstractConnectionTester.activeCheckConnection(AbstractConnectionTester.java:67)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:368)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:310)
      com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:1999)
      com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
   Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,4,main]
      net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:679)
      net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:466)
      net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:103)
      net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2172)
      net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:725)
      net.sourceforge.jtds.jdbc.ConnectionJDBC2.releaseTds(ConnectionJDBC2.java:1765)
      net.sourceforge.jtds.jdbc.JtdsStatement.close(JtdsStatement.java:794)
      net.sourceforge.jtds.jdbc.JtdsPreparedStatement.close(JtdsPreparedStatement.java:402)
      net.sourceforge.jtds.jdbc.ConnectionJDBC2.close(ConnectionJDBC2.java:1842)
      com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:474)
      com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:191)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)
      com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
      com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)



I don't know what additional information can be useful so here is some info about my config:
-c3p0 v. 0.9.1
-maxAdministrativeTaskTime and numHelperThreads are not specified so I beleive default values are used
- what else can help?

Please, give me an advise on resolving the issue. If any additional information needed I will provide it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.