X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 53371DBA52 for ; Wed, 23 Nov 2005 15:44:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13371-01 for ; Wed, 23 Nov 2005 19:44:02 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 097B4D9634 for ; Wed, 23 Nov 2005 15:43:58 -0400 (AST) Received: (qmail 27615 invoked from network); 23 Nov 2005 19:47:00 -0000 Received: from unknown (HELO ?127.0.0.1?) (63.111.27.212) by mail63.csoft.net with SMTP; 23 Nov 2005 19:47:00 -0000 Message-ID: <4384C6B4.1090603@ejurka.com> Date: Wed, 23 Nov 2005 11:44:52 -0800 From: Kris Jurka User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20051011 Debian/1.7.12-1 X-Accept-Language: en MIME-Version: 1.0 To: kalisetty manideep CC: pgsql-jdbc@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: BUG #2060: Issue with Data base connection References: <20051122044944.25648.qmail@web30705.mail.mud.yahoo.com> In-Reply-To: <20051122044944.25648.qmail@web30705.mail.mud.yahoo.com> Content-Type: multipart/mixed; boundary="------------020004030600060108030308" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/241 X-Sequence-Number: 13605 This is a multi-part message in MIME format. --------------020004030600060108030308 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit kalisetty manideep wrote: > [Backend reports "too many open connections"] > > But I am 100% sure that its not the issue with the > code. > > Do you know any Postgresql - JDBC driver, which is not > from Postgresql development group. I think JDBC driver > is not closing the connection even though I am closing > the connection. I have no reason to believe that and you certainly haven't shown that. > Please refer to the DBACCESS file attached. > All this shows is the Connection being opened, not closed. I've implemented an idea I got from rupa in #postgresql a while ago about a way of logging leaked connections. I've added some code to the Connection's finalize() method that prints some logging information if the Connection was not closed. This is enabled by using the new logUnclosedConnections URL parameter. See the attached code for an example. I've put up a new jar that contains this here: http://www.ejurka.com/pgsql/jars/km --------------020004030600060108030308 Content-Type: text/x-java; name="OpenConn.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="OpenConn.java" import java.sql.*; public class OpenConn { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); leakConnection(); System.gc(); } private static void leakConnection() throws Exception { Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5810/jurka?logUnclosedConnections=true","jurka",""); } } --------------020004030600060108030308--