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 00C8A2D43 for ; Sat, 23 Apr 2011 23:57:46 +0000 (UTC) Received: (qmail 3012 invoked by uid 500); 23 Apr 2011 23:57:46 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 2941 invoked by uid 500); 23 Apr 2011 23:57:46 -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 2930 invoked by uid 99); 23 Apr 2011 23:57:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Apr 2011 23:57:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Apr 2011 23:57:44 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id C6855AFA81 for ; Sat, 23 Apr 2011 23:57:05 +0000 (UTC) Date: Sat, 23 Apr 2011 23:57:05 +0000 (UTC) From: "Phil Steitz (JIRA)" To: issues@commons.apache.org Message-ID: <224838139.78608.1303603025809.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (DBCP-330) Calling getMetaData() without closing the connection lead to a memory leak 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-330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Phil Steitz resolved DBCP-330. ------------------------------ Resolution: Fixed Fixed in trunk (r1096260) and 1_4 branch (r1096259). > Calling getMetaData() without closing the connection lead to a memory leak > -------------------------------------------------------------------------- > > Key: DBCP-330 > URL: https://issues.apache.org/jira/browse/DBCP-330 > Project: Commons Dbcp > Issue Type: Bug > Affects Versions: 1.4 > Environment: Linux Mint 8 Helena - Universal Edition > Linux version 2.6.31-14-generic (buildd@rothera) (gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8) ) #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 > java version "1.6.0_15" > Java(TM) SE Runtime Environment (build 1.6.0_15-b03) > Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing) > Reporter: Timothee Maret > Priority: Minor > Fix For: 1.4.1 > > > In my program, I am using a BasicDataSource to get my database connections. I have to keep one of the connection alive and thus never close it. On this connection, I have to periodically get the metadata (call the getMetaData() method) for my processing. > However, I have noticed that each call to this method create a new DelegatingDatabaseMetaData instance which can't be garbage collected until the connection is closed. This creation of DelegatingDatabaseMetaData will finally consume all the memory and generate a OutOfMemory error. > Actually, in it's constructor, the DelegatingDatabaseMetaData class calls its super constructor (from the AbandonedTrace class) which creates a reference (parent.addTrace(this);) from the connection to the DelegatingDatabaseMetaData. This reference prevent the DelegatingDatabaseMetaData to be collected until the Connection is closed. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira