PoolWatchThread does not respect a minConnectionsPerPartition=0

Bug #1258941 reported by Meletis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
BoneCP
New
Undecided
Wallace Wadge

Bug Description

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 = 50

{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?

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

It looks to me that somehow the "this.partition.getMinConnections()" should be a part of the condition of the "while" clause.

description: updated
Changed in bonecp:
assignee: nobody → Wallace Wadge (wwadge)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.