On Mar 28, 2013, at 8:27 AM, amit shah wrote:

> Hello,
>         I am using the tomcat jdbc connection pool independently in my web

Because you are using this independently you are going to need to tell us the 
version of the connection pool that you have included with your application.  
Also, a code snippet that shows how you setup the connection pool, we need to 
see what options that you have used.

> application which is deployed on glassfish web server. While performing a
> database operation,

What specifically are you doing in the application?  Can you include a code 
snippet?  In particular, we'd want to see how you are getting a connection, how 
its being used and how you are returning it to the pool.

> our application goes into a deadlock state.

How are you determining this?  What is the behavior that you see with your 
application?

Dan



> The two threads involved in the deadlock have the below traces (from a thread 
> dump)
> 
> "thread1" Id=534 WAITING on
> java.util.concurrent.locks.ReentrantReadWriteLock$FairSync@184ffd83 owned
> by "thread2" Id=529
> at sun.misc.Unsafe.park(Native Method)
> -  waiting on
> java.util.concurrent.locks.ReentrantReadWriteLock$FairSync@184ffd83
> at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
> at
> java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
> at
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
> at
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
> at
> java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945)
> at
> com.sun.ejb.containers.CMCSingletonContainer._getContext(CMCSingletonContainer.java:142)
> at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2528)
> ...
> 
> Number of locked synchronizers = 1
> - java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@3f88774b
> 
> , "thread2" Id=529 WAITING on
> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@3f88774bowned
> by "thread1" Id=534
> at sun.misc.Unsafe.park(Native Method)
> -  waiting on
> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@3f88774b
> at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
> at
> java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
> at
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
> at
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
> at
> java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945)
> at
> org.apache.tomcat.jdbc.pool.PooledConnection.lock(PooledConnection.java:609)
> at
> org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:752)
> ...
> 
> Number of locked synchronizers = 1
> - java.util.concurrent.locks.ReentrantReadWriteLock$FairSync@184ffd83
> 
> 
> Having a look at the source code for both
> <http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_34/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java>of
> these 
> <http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.ejb/ejb-container/3.1.1/com/sun/ejb/containers/CMCSingletonContainer.java?av=f>
> I
> see different lock instances but still the dump indicates that they are the
> same. Any idea on how can the java.util.lock instances be the same?
> 
> Thanks,
> Amit.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to