Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VYn72-0001Pj-WA for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Oct 2013 01:19:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VYn72-0007aA-FO for pgsql-jdbc@arkaria.postgresql.org; Wed, 23 Oct 2013 01:19:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VYn70-0007Xb-S6 for pgsql-jdbc@postgresql.org; Wed, 23 Oct 2013 01:19:50 +0000 Received: from smtp180.dfw.emailsrvr.com ([67.192.241.180]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VYn6v-0004qQ-9F for pgsql-jdbc@postgresql.org; Wed, 23 Oct 2013 01:19:49 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp8.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 57C908277 for ; Tue, 22 Oct 2013 21:19:41 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp8.relay.dfw1a.emailsrvr.com (Authenticated sender: david.wall-AT-yozons.com) with ESMTPSA id 0763582BA for ; Tue, 22 Oct 2013 21:19:40 -0400 (EDT) Message-ID: <52672420.6090109@computer.org> Date: Tue, 22 Oct 2013 18:19:28 -0700 From: David Wall User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Remove usage of finalizers ? References: <9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de> In-Reply-To: Content-Type: multipart/alternative; boundary="------------030607010908050900010303" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org This is a multi-part message in MIME format. --------------030607010908050900010303 Content-Type: text/plain; charset=KOI8-U; format=flowed Content-Transfer-Encoding: 8bit I agree that this is not a server side leak. Anybody doing JDBC programming should know to do this, typically using a 'try-catch-finally', with the finally handling the cleanup of the Connection and Statement. As I understand it, if you close a Statement, it will also close any ResultSets that you may have acquired from it so you don't have to close the ResultSet specifically. On 10/22/2013 6:03 PM, Dave Cramer wrote: > That's rather harsh. How do you see this as introducing a server side > leak ? Statements are supposed to be closed by applications as are > connections. > > Dave Cramer > > dave.cramer(at)credativ(dot)ca > http://www.credativ.ca > > > On Tue, Oct 22, 2013 at 8:36 PM, Vitalii Tymchyshyn > wrote: > > As for me, introducing server-side leak would be plain wrong. If > it will be done, please announce in the list, I will stop > recommending using postgresql in java projects. > > 23 жовт. 2013 03:12, користувач "Tom Dunstan" > написав: > > On 21 October 2013 23:03, Dave Cramer > wrote: > > Please send patches for possible solutions. I think I would > be OK with > > removing them and letting people find their Statement leaks > > One option if we want to keep the existing behaviour available > in some > way would be to remove the finalize method from > AbstractJdbc2Statement > and create subclasses of the various concrete statement > classes which > could be used when a debug flag is switched on. e.g. > DebugJdbc3Statement, DebugJdbc3PreparedStatement, > DebugJdbc3CallableStatement etc which have the finalizer present. > > There would be quite a few of them though, and we'd need to have a > switch everywhere that one of those is instantiated, or > introduce a > factory. It's a bit gross. > > IMO tracing non-closed statement leaks is probably better done > in a > connection pool or jdbc debugging library anyway, so maybe we > shouldn't bother and just remove it. > > One question is this, though: how many users out there aren't > closing > their statements currently and are relying, accidentally or > deliberately, on the current behaviour? > > Tom > > --------------030607010908050900010303 Content-Type: text/html; charset=KOI8-U Content-Transfer-Encoding: 8bit I agree that this is not a server side leak.  Anybody doing JDBC programming should know to do this, typically using a 'try-catch-finally', with the finally handling the cleanup of the Connection and Statement.  As I understand it, if you close a Statement, it will also close any ResultSets that you may have acquired from it so you don't have to close the ResultSet specifically. 


On 10/22/2013 6:03 PM, Dave Cramer wrote:
That's rather harsh. How do you see this as introducing a server side leak ? Statements are supposed to be closed by applications as are connections.

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Tue, Oct 22, 2013 at 8:36 PM, Vitalii Tymchyshyn <vit@tym.im> wrote:

As for me, introducing server-side leak would be plain wrong. If it will be done, please announce in the list, I will stop recommending using postgresql in java projects.

23 жовт. 2013 03:12, користувач "Tom Dunstan" <pgsql@tomd.cc> написав:

On 21 October 2013 23:03, Dave Cramer <pg@fastcrypt.com> wrote:
> Please send patches for possible solutions. I think I would be OK with
> removing them and letting people find their Statement leaks

One option if we want to keep the existing behaviour available in some
way would be to remove the finalize method from AbstractJdbc2Statement
and create subclasses of the various concrete statement classes which
could be used when a debug flag is switched on. e.g.
DebugJdbc3Statement, DebugJdbc3PreparedStatement,
DebugJdbc3CallableStatement etc which have the finalizer present.

There would be quite a few of them though, and we'd need to have a
switch everywhere that one of those is instantiated, or introduce a
factory. It's a bit gross.

IMO tracing non-closed statement leaks is probably better done in a
connection pool or jdbc debugging library anyway, so maybe we
shouldn't bother and just remove it.

One question is this, though: how many users out there aren't closing
their statements currently and are relying, accidentally or
deliberately, on the current behaviour?

Tom


--------------030607010908050900010303--