commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Smith" <>
Subject Re: [dbcp] Database connections disappear from the pool
Date Sun, 30 Oct 2005 21:31:35 GMT
Hi Keijo,

refer to previous emails I sent with HIGH PRIORITY in the subject. I 
would suggest what Dave suggested to me use a package call c3po. You can 
find it here Download it to have 
a read through the documentation, I did and it sounds great. The quy 
developing it sounds like he really knows what he's doing. I have yet to 
integrate it into our application but I will be doing so this week. DBCP 
doesn't seem to have the support anymore and is not really moving 
forwards very quickly.


Keijo Lehto wrote:

>we're currently having problems with DBCP connection pooling on a
>server application we've developed. Our app runs perfectly for hours
>serving tens of thousands of requests, but suddenly, it just freezes
>while trying to get a database connection from the DBCP pool.
>We've added more verbose logging to the application and discovered
>that just before hanging, the pool is working fine (1 active, 4 idle
>conns) but then suddenly, after returning a connection to the pool as
>usual we find out that the next time we try to borrow a connection,
>there are 0 active and 0 idle connections in the pool.
>At that point, the thread just waits indefinitely (well, at least for
>hours) for the return from the call to
>DriverManager.getConnection("jdbc:apache:commons:dbcp:/poolname"). No
>Exceptions are thrown, no timeouts, no nothing.
>The server application is responsive, though, and it accepts new
>connections on new threads, which will also hang. However, all these
>consequent requests hang already while trying to print the pool
>statistics from corresponding ObjectPool so they don't even get to the
>point of calling the getConnection(). We do, however, get the
>ObjectPool from DriverManager:
>PoolingDriver driver = (PoolingDriver)
>ObjectPool connectionPool = driver.getConnectionPool("/poolname");
>Based on our analysis, we could not see any correlation between the
>number of served requests and the problem. We also haven't been able
>to reproduce the problem in our testing environments, it only occurs
>in the production. So far, we haven't been able to see anything
>special in e.g. the rate of requests before the hanging.
>I haven't been able to find any previous conversation on similar
>problems and we feel that the problem could be related to internals of
>either DBCP or Jakarta Pool. Any ideas, references, comments?
>Best regards,
>- keke
>PS. here are some details on our current configuration.
>The database in use: Oracle 9.2.0
>OS: SunOS 5.8
>Our current jocl configuration is as follows:
><object class="org.apache.commons.dbcp.PoolableConnectionFactory"
>  <!-- the first argument is the ConnectionFactory -->
>  <object class="org.apache.commons.dbcp.DriverManagerConnectionFactory">
>     <string value="jdbc:oracle:thin:xxx/xxx@xxx:xxx:xxxx"/>
>     <object class="java.util.Properties" null="true"/>
>  </object>
>  <!-- the next argument is the ObjectPool -->
>  <object class="org.apache.commons.pool.impl.GenericObjectPool">
>     <object class="org.apache.commons.pool.PoolableObjectFactory"
>     <int value="50"/> <!-- max active -->
>     <byte value="0"/> <!-- when exhausted action, 0 = fail, 1 =
>block, 2 = grow -->
>     <long value="2000"/> <!-- max wait -->
>     <int value="20"/> <!-- max idle -->
>     <int value="5"/> <!-- min idle -->
>     <boolean value="false"/> <!-- test on borrow -->
>     <boolean value="false"/> <!-- test on return -->
>     <long value="10000"/> <!-- time between eviction runs -->
>     <int value="5"/> <!-- number of connections to test per eviction run -->
>     <long value="5000"/> <!-- min evictable idle time -->
>     <boolean value="true"/> <!-- test while idle -->
>  </object>
>  <!-- the next argument is the KeyedObjectPoolFactory -->
>  <object class="org.apache.commons.pool.impl.StackKeyedObjectPoolFactory">
>     <int value="5"/> <!-- max idle -->
>  </object>
>  <string value="SELECT COUNT(*) FROM DUAL"/> <!-- validation query -->
>  <boolean value="false"/> <!-- default read only -->
>  <boolean value="true"/> <!-- default auto commit -->
>To unsubscribe, e-mail:
>For additional commands, e-mail:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message