Comment 0 for bug 1258941

Revision history for this message
Meletis (m-margaritis) wrote :

Hello,

We are currently using 0.8.0 with the following configuration:

bonecp.partitionCount=1
bonecp.minConnectionsPerPartition=0
bonecp.maxConnectionsPerPartition=50
bonecp.acquireIncrement=1
bonecp.connectionTimeoutInMs=15000
bonecp.idleMaxAgeInSeconds=180
bonecp.idleConnectionTestPeriodInSeconds=181
bonecp.poolAvailabilityThreshold=0
bonecp.disableConnectionTracking=true

We have been noticing that the minimum is not respected. Actually the "PoolWatchThread" always opens up a new connection when the available are 0. During debugging of that class and where there is NO OTHER db activity via our app, here is what we get: When the debugger has reached line 82 of PoolWatchThread.java we have:

this.partition.getMaxConnections() = 50
this.partition.getCreatedConnections() = 0
this.partition.getAvailableConnections() = 0
maxNewConnections = 0

{code}
    maxNewConnections = this.partition.getMaxConnections()-this.partition.getCreatedConnections();
    // loop for spurious interrupt
    while (maxNewConnections == 0 || (this.partition.getAvailableConnections() *100/this.partition.getMaxConnections() > this.poolAvailabilityThreshold)){
     if (maxNewConnections == 0){
      this.partition.setUnableToCreateMoreTransactions(true);
     }

     this.partition.getPoolWatchThreadSignalQueue().take();
     maxNewConnections = this.partition.getMaxConnections()-this.partition.getCreatedConnections();

    }

    if (maxNewConnections > 0
      && !this.pool.poolShuttingDown){
line 82 ---> fillConnections(Math.min(maxNewConnections, this.partition.getAcquireIncrement()));
     // for the case where we have killed off all our connections due to network/db error
     if (this.partition.getCreatedConnections() < this.partition.getMinConnections()){
      fillConnections(this.partition.getMinConnections() - this.partition.getCreatedConnections() );

     }
    }
{code}

That means the "Math.min(maxNewConnections, this.partition.getAcquireIncrement())" gets to be 1, so an extra connection gets created for no reason and the setting minConnectionsPerPartition=0 never applies.

I believe that the behavior above should be okay if we had minConnectionsPerPartition=1 and not 0.

Is this a bug or are we missing something?