-1

Below is my DBCP Connection Pool configuration,

<property name="maxWait" value="30000"/>
<property name="maxActive" value="100"/>
<property name="minIdle" value="0"/>
<property name="minEvictableIdleTimeMillis" value="60000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="validationQuery" value="select sysdate from dual" />
<property name="testOnBorrow" value="true" />
<property name="tryRecoveryInMinutes" value="0.25" />

however I am getting below exception in Thread dump file.

"mythread-10444" prio=10 tid=0x00007ff098de9800 nid=0x77c runnable [0x00007ff0fd289000]
   java.lang.Thread.State: RUNNABLE
    at oracle.jdbc.driver.T2CStatement.t2cParseExecuteDescribe(Native Method)
    at oracle.jdbc.driver.T2CStatement.executeForDescribe(T2CStatement.java:703)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1175)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1296)
    at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1498)
    - locked <0x00000000e434a3c0> (a oracle.jdbc.driver.T2CConnection)
    at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:406)
    at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
    at org.apache.commons.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:658)
    at org.apache.commons.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:635)
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1165)
    at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)

Initially it is working fine, But after some time my application hanging completely. Could you please let me know what is the issue?

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
Srinivasan
  • 11,718
  • 30
  • 64
  • 92
  • The title does not capture the gist of the problem because from what I understand the problem is not actually the connection pool. Please update the title to make the question useful to others. – oberlies Nov 02 '18 at 09:53

3 Answers3

0

The exception clearly states that your Thread is still running and your connection is locked while it's busy executing a query.

at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1498)
    - locked <0x00000000e434a3c0> (a oracle.jdbc.driver.T2CConnection)

My concern will be to find out which query is executing at that long (before the timeout) and optimize it. Based on the exception stacktrace, you are doing a DESCRIBE which the Oracle RDMS has a lock on that query and its still execute while trying to run another query.

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
  • I do not know which query is taking too much of time. all are somewhat small query only. After some time, it does not pass any query request to DB. Just hanging. – Srinivasan Apr 23 '15 at 13:07
  • Ask your DB administrators to identify all queries that the RDBMS executes and see what causes the issue. – Buhake Sindi Apr 23 '15 at 13:09
0

Considering a Spring environment, did you properly define a transaction-manager bean in your Spring configuration XML?

  <!-- Spring transaction manager -->
  <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
      <property name="entityManagerFactory" ref="emf" />
  </bean>

  <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="*" propagation="REQUIRED" />
    </tx:attributes>
</tx:advice>

<!-- Spring transaction management per transactional-annotation -->
<tx:annotation-driven transaction-manager="transactionManager" />

In my team we had a similar issue a few weeks ago, not noticing that this section was wrapped by a comment in our Spring XML. As a result a bunch of transactions never got commited ideling in front of the database. Hope this helps.

pklndnst
  • 726
  • 2
  • 10
  • 27
  • It is working fine without any issue for first few days. After that connection is hanging or not getting connection from pool. – Srinivasan Apr 23 '15 at 13:06
  • You could try using JConsole to keep track of the resources in the application's JVM process. Maybe this can help you to understand what's going on. It seems like your application threads are starving waiting for the database to respond. Some kind of table lock? Another approach could be the use of C3P0 connection pool instead of hibernate's built-in pool. Sometimes this helps. – pklndnst Apr 23 '15 at 13:27
0

I had similar issues with my application using dbcp. And it turned out that the connections were not closed properly. On exceptions the connections were leaked and hence leading to deadlocks after some time. I have written a full explanation here

awsome
  • 2,143
  • 2
  • 23
  • 41