Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 47200 invoked from network); 29 Jul 2010 21:19:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Jul 2010 21:19:41 -0000 Received: (qmail 20232 invoked by uid 500); 29 Jul 2010 21:19:41 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 20112 invoked by uid 500); 29 Jul 2010 21:19:40 -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 20104 invoked by uid 99); 29 Jul 2010 21:19:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Jul 2010 21:19:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Jul 2010 21:19:38 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o6TLJGFE019279 for ; Thu, 29 Jul 2010 21:19:16 GMT Message-ID: <28625648.76851280438356571.JavaMail.jira@thor> Date: Thu, 29 Jul 2010 17:19:16 -0400 (EDT) From: "Dmitry Semibratov (JIRA)" To: issues@commons.apache.org Subject: [jira] Issue Comment Edited: (DBCP-339) orphaned connectionPools created on Exception within createDataSource method In-Reply-To: <29079768.261961278607430758.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DBCP-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12893828#action_12893828 ] Dmitry Semibratov edited comment on DBCP-339 at 7/29/10 5:18 PM: ----------------------------------------------------------------- Proposed solution to close connection pool, if an Exception is thrown, should work. Pool instances will be closed and associated eviction timer tasks will be canceled, and eventually garbage collected. The patch file is attached. was (Author: dimas): Proposed solution to close connection pool if anException is thrown should work. Pool instances will be closed and associated eviction timer tasks will be canceled, and eventually garbage collected. The patch file is attached. > orphaned connectionPools created on Exception within createDataSource method > ---------------------------------------------------------------------------- > > Key: DBCP-339 > URL: https://issues.apache.org/jira/browse/DBCP-339 > Project: Commons Dbcp > Issue Type: Bug > Affects Versions: 1.2.2, 1.3, 1.4 > Environment: Linux > MySQL 5.1.47 > JDK 1.6 > commonsPool 1.5.4 > Reporter: Mike Bartlett > Attachments: DBCP-339.patch > > > When an Exception is thrown in the BasicDataSource.createDataSource after the connectionPool instance variable has been set the connectionPool is not closed. > If the timeBetweenEvictionRunsMillis is greater than zero a TaskTimer evictor is created in the GenericObjectPool. This TaskTimer keeps running even though the DataSource was not successfully created. The evictor when it runs will attempt to create connections for this orphaned connectionPool up to the min connections (minIdle). > If the database is down when the createDataSource is called an Exception will be thrown and an orphaned connectionPool will be created. If serveral retries are attempted while the database is down several orphaned connectionPools are created. Once the database is back up, all these orphaned connectionPool's evitor threads will attempt to created minIdle connections to the database. This exhausts the max num connections on the database. > One solution to to close the connectionPool when an Exception is thrown within the createDataSource method. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.