Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 15E301041B for ; Fri, 31 Jan 2014 19:44:26 +0000 (UTC) Received: (qmail 67283 invoked by uid 500); 31 Jan 2014 19:44:16 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 67199 invoked by uid 500); 31 Jan 2014 19:44:14 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 67103 invoked by uid 99); 31 Jan 2014 19:44:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jan 2014 19:44:12 +0000 Date: Fri, 31 Jan 2014 19:44:12 +0000 (UTC) From: "Mark Thomas (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (DBCP-390) calling invalidObject(badConnection) damage the counting of the objects in the pool. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DBCP-390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mark Thomas resolved DBCP-390. ------------------------------ Resolution: Cannot Reproduce >From the description provided I can't reproduce this. All the code paths I can see where a Factory might return a null connection trigger an ISE. Please feel free to re-open this issue if you can provide a JUnit test case that demonstrates the issue. Note that this issue will not affect DBCP 2.x as it depends on Pool 2.x that implements full object tracking and is therefore able to keep a better tracl of the number of active and idle objects. > calling invalidObject(badConnection) damage the counting of the objects in the pool. > ------------------------------------------------------------------------------------- > > Key: DBCP-390 > URL: https://issues.apache.org/jira/browse/DBCP-390 > Project: Commons Dbcp > Issue Type: Bug > Affects Versions: 1.4 > Environment: All env > Reporter: neng xu > > We are using DBCP pool. The pattern of using DBCP pool is same as Apache DBCP pool example PoolingDataSourceDataSourceExample.java. When cleaning bad connections, I noticed that it called pool.invalidObject(object) method to clean the bad connection object from the pool. Recently we found that calling invalidObject(object) could damage the number of active connections of the pool because this method always silently reduce the number regardless the objects was removed from pool or not. For example, when the connection object is null (creating database connection timeout happens), calling invalidObject(badConnection) would cause the number of Active connections to be reduce one even the method did not remove any object from pool. This damage the counting of the object in the pool. > This method should only reduce the number of the objects in the pool when it successfully removed an object from the pool. > Note: I understand that we may resolve the problem by checking object is null (or object is in pool) before calling invalidObject() method. But I think it is just a first-aid solution. -- This message was sent by Atlassian JIRA (v6.1.5#6160)