commons-user mailing list archives

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

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 

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, 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

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).


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

View raw message