You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "cauherk (JIRA)" <ji...@apache.org> on 2011/04/19 19:02:05 UTC
[jira] [Created] (POOL-185) when continue kill all connection ,
Cannot get a connection.
when continue kill all connection , Cannot get a connection.
-------------------------------------------------------------
Key: POOL-185
URL: https://issues.apache.org/jira/browse/POOL-185
Project: Commons Pool
Issue Type: Bug
Affects Versions: 1.5.5
Environment: suse enterprise linux 11 (64 bit)
jdk1.5.0_21 (32 bit)
oracle 10.2.0.3(64 bit)
commons-pool-1.5.5.jar
commons-dbcp-1.3.jar
configure
<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@10.70.193.1:1521:ora10g"/>
<property name="username" value="yh"/>
<property name="password" value="yh"/>
<property name="initialSize" value="9"/>
<property name="maxActive" value="18"/>
<property name="maxIdle" value="6"/>
<property name="minIdle" value="2"/>
<property name="maxWait" value="2000"/>
<property name="validationQuery" value="select 1 from dual"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<property name="timeBetweenEvictionRunsMillis" value="3000"/>
<property name="numTestsPerEvictionRun" value="2"/>
Reporter: cauherk
After program startup,continue kill all connection.Use oracle command "alter system kill session 'sid,#p'".
Exception
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at test.TestConn.aa(TestConn.java:18)
at test.TestConn.main(TestConn.java:49)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1144)
at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
... 7 more
java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object
at test.TestConn.aa(TestConn.java:18)
at test.TestConn.main(TestConn.java:49)
I debug org.apache.commons.pool.impl.GenericObjectPool.
public synchronized void evict() throws Exception {
assertOpen();
if(!_pool.isEmpty()) {
...
} // if !empty
}
but _pool.isEmpty() is always empty,can not run into.
private synchronized int calculateDeficit(boolean incrementInternal) {
int objectDeficit = getMinIdle() - getNumIdle();
if (_maxActive > 0) {
int growLimit = Math.max(0,
getMaxActive() - getNumActive() - getNumIdle() - _numInternalProcessing);
objectDeficit = Math.min(objectDeficit, growLimit);
}
if (incrementInternal && objectDeficit >0) {
_numInternalProcessing++;
}
return objectDeficit;
}
calculateDeficit method is always return 0.
So program always throw exception.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (POOL-185) when continue kill all connection ,
Cannot get a connection.
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/POOL-185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13022603#comment-13022603 ]
Phil Steitz commented on POOL-185:
----------------------------------
When you kill all the connections on the server side, how many are checked out by clients?
If the answer == maxActive, then this is not a bug, but pool and dbcp working as designed. The pool contract is that no more than maxActive instances will be in circulation (either idle in the pool or checked out to clients) at a given time. When you kill the connections, the pool has no direct way of learning about this. You need to close the connections to make the instance count available. If the driver reports isClosed() correctly, DBCP will invalidate the bad instances as you close the connection handles. If this is a regular occurrence, it is best to set testOnBorrow and/or textOnReturn to true to ensure bad connections do not get handed back to clients.
The evict() code mentioned is irrelevant. ensureMinIdle is called directly by the run method of the Evictor.
Unless I am misunderstanding something, this looks like a question for the user list, not a pool or dbcp bug.
> when continue kill all connection , Cannot get a connection.
> -------------------------------------------------------------
>
> Key: POOL-185
> URL: https://issues.apache.org/jira/browse/POOL-185
> Project: Commons Pool
> Issue Type: Bug
> Affects Versions: 1.5.5
> Environment: suse enterprise linux 11 (64 bit)
> jdk1.5.0_21 (32 bit)
> oracle 10.2.0.3(64 bit)
> commons-pool-1.5.5.jar
> commons-dbcp-1.3.jar
> configure
> <property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
> <property name="url" value="jdbc:oracle:thin:@10.70.193.1:1521:ora10g"/>
> <property name="username" value="yh"/>
> <property name="password" value="yh"/>
> <property name="initialSize" value="9"/>
> <property name="maxActive" value="18"/>
> <property name="maxIdle" value="6"/>
> <property name="minIdle" value="2"/>
> <property name="maxWait" value="2000"/>
> <property name="validationQuery" value="select 1 from dual"/>
> <property name="testWhileIdle" value="true"/>
> <property name="testOnBorrow" value="false"/>
> <property name="testOnReturn" value="false"/>
> <property name="timeBetweenEvictionRunsMillis" value="3000"/>
> <property name="numTestsPerEvictionRun" value="2"/>
> Reporter: cauherk
>
> After program startup,continue kill all connection.Use oracle command "alter system kill session 'sid,#p'".
> Exception
> org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
> at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
> at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
> at test.TestConn.aa(TestConn.java:18)
> at test.TestConn.main(TestConn.java:49)
> Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
> at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1144)
> at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
> at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
> ... 7 more
> java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object
> at test.TestConn.aa(TestConn.java:18)
> at test.TestConn.main(TestConn.java:49)
> I debug org.apache.commons.pool.impl.GenericObjectPool.
> public synchronized void evict() throws Exception {
> assertOpen();
> if(!_pool.isEmpty()) {
> ...
> } // if !empty
> }
>
> but _pool.isEmpty() is always empty,can not run into.
> private synchronized int calculateDeficit(boolean incrementInternal) {
> int objectDeficit = getMinIdle() - getNumIdle();
> if (_maxActive > 0) {
> int growLimit = Math.max(0,
> getMaxActive() - getNumActive() - getNumIdle() - _numInternalProcessing);
> objectDeficit = Math.min(objectDeficit, growLimit);
> }
> if (incrementInternal && objectDeficit >0) {
> _numInternalProcessing++;
> }
> return objectDeficit;
> }
>
> calculateDeficit method is always return 0.
> So program always throw exception.
>
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (POOL-185) when continue kill all connection ,
Cannot get a connection.
Posted by "Mark Thomas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/POOL-185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Thomas resolved POOL-185.
------------------------------
Resolution: Invalid
No response from OP - assume this is a question for the users list.
> when continue kill all connection , Cannot get a connection.
> -------------------------------------------------------------
>
> Key: POOL-185
> URL: https://issues.apache.org/jira/browse/POOL-185
> Project: Commons Pool
> Issue Type: Bug
> Affects Versions: 1.5.5
> Environment: suse enterprise linux 11 (64 bit)
> jdk1.5.0_21 (32 bit)
> oracle 10.2.0.3(64 bit)
> commons-pool-1.5.5.jar
> commons-dbcp-1.3.jar
> configure
> <property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
> <property name="url" value="jdbc:oracle:thin:@10.70.193.1:1521:ora10g"/>
> <property name="username" value="yh"/>
> <property name="password" value="yh"/>
> <property name="initialSize" value="9"/>
> <property name="maxActive" value="18"/>
> <property name="maxIdle" value="6"/>
> <property name="minIdle" value="2"/>
> <property name="maxWait" value="2000"/>
> <property name="validationQuery" value="select 1 from dual"/>
> <property name="testWhileIdle" value="true"/>
> <property name="testOnBorrow" value="false"/>
> <property name="testOnReturn" value="false"/>
> <property name="timeBetweenEvictionRunsMillis" value="3000"/>
> <property name="numTestsPerEvictionRun" value="2"/>
> Reporter: cauherk
>
> After program startup,continue kill all connection.Use oracle command "alter system kill session 'sid,#p'".
> Exception
> org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
> at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
> at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
> at test.TestConn.aa(TestConn.java:18)
> at test.TestConn.main(TestConn.java:49)
> Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
> at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1144)
> at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
> at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
> ... 7 more
> java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object
> at test.TestConn.aa(TestConn.java:18)
> at test.TestConn.main(TestConn.java:49)
> I debug org.apache.commons.pool.impl.GenericObjectPool.
> public synchronized void evict() throws Exception {
> assertOpen();
> if(!_pool.isEmpty()) {
> ...
> } // if !empty
> }
>
> but _pool.isEmpty() is always empty,can not run into.
> private synchronized int calculateDeficit(boolean incrementInternal) {
> int objectDeficit = getMinIdle() - getNumIdle();
> if (_maxActive > 0) {
> int growLimit = Math.max(0,
> getMaxActive() - getNumActive() - getNumIdle() - _numInternalProcessing);
> objectDeficit = Math.min(objectDeficit, growLimit);
> }
> if (incrementInternal && objectDeficit >0) {
> _numInternalProcessing++;
> }
> return objectDeficit;
> }
>
> calculateDeficit method is always return 0.
> So program always throw exception.
>
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira