commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victor Novichihin <vnovichi...@warelex.com>
Subject DBCP: error in the Configuration docs / DBCP hangs when exhausted
Date Sat, 03 Mar 2007 16:03:10 GMT
Hello,

I have noted an error in the DBCP 1.2.1 documentation; due to this 
error, my server hung and it took several days to find the reason.
What the documentation say 
(http://jakarta.apache.org/commons/dbcp/configuration.html):

maxActive -  The maximum number of active connections that can be 
allocated from this pool at the same time, or __non-positive__ for no limit.

Non-positive means 0, -1, -2, ...

But look in GenericObjectPool.java, line 797 (GenericObjectPool class, 
borrowObject method):

// otherwise
if(null == pair) {

  // check if we can create one
  // (note we know that the num sleeping is 0, else we wouldn't be here)
  if(_maxActive < 0 || _numActive < _maxActive) {
      // allow new object to be created
      ...
      wait();
      ...

These lines of code are executed when, for example, all your pooled 
connections became invalid (because of inactivity/timeout period), so 
the pool is now empty and we are deciding to create or not to create a 
new object. In my case, the server hung in wait() waiting for new 
connections in the pool, but maxActive was 0 and nobody created new objects.

That the documentation says "non-positive" for unlimited case, but it 
should say "negative" (that is -1, -2, ...; but not 0).

--
 Victor

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message