0

from my application, many threads are trying to get a connection from oracle but I am seeing only one thread is able to get connection at a time. till this thread gets connection, other threads are blocked which is causing slowness in application. I need help determining why other threads are getting blocked. am i running out of connections than the available connections in pool?

Thread holding the lock.

org.apache.commons.dbcp2.managed.LocalXAConnectionFactory.createConnection(LocalXAConnectionFactory.java:68)
    at org.apache.commons.dbcp2.managed.PoolableManagedConnectionFactory.makeObject(PoolableManagedConnectionFactory.java:64)

- locked <0x0000000641e88660> (a org.apache.commons.dbcp2.managed.PoolableManagedConnectionFactory)
    at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868)
    at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
    at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
    at org.apache.commons.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:125)
    at org.apache.commons.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:59)
    at org.apache.commons.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:81)
    at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1413)
    at com.manh.jdbc.ScopeDataSource.getConnection(ScopeDataSource.java:79)


Thread waiting for lock on PoolableManagedConnectionFactory

"pool-38-thread-5389" #267084 prio=5 os_prio=0 tid=0x00002b6b66541800 nid=0x18dcf waiting for monitor entry [0x00002b6bfd047000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at org.apache.commons.dbcp2.managed.PoolableManagedConnectionFactory.makeObject(PoolableManagedConnectionFactory.java:64)
    - waiting to lock <0x0000000641e88660> (a org.apache.commons.dbcp2.managed.PoolableManagedConnectionFactory)
    at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868)
    at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
    at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
    at org.apache.commons.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:125)
    at org.apache.commons.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:59)
user207421
  • 305,947
  • 44
  • 307
  • 483
  • 1
    Are you forgetting to commit or close your connections? – Scary Wombat Nov 11 '19 at 02:31
  • I am not sure on connection leaks as my application is very vast, Do you think connection pool has exhausted due to connection leaks in applications by looking at the stack trace? – Vavilapalli Surapu Naidu Nov 11 '19 at 03:19
  • Definitely. It isn't blocked opening a connection, it is blocked on some monitor in the pool, which suggests it's waiting for a connection to be freed. Apache DBCP has some leak detection tools in it. Use them. – user207421 Nov 11 '19 at 03:28
  • 1
    Can you add the configuration for your connection pool, the code that uses the pool and how many threads are utilizing the pool concurrently. – M. Deinum Nov 11 '19 at 08:46

0 Answers0