From: David Wall <d.wall@computer.org>
To: pgsql-jdbc@postgresql.org
Subject: Re: Remove usage of finalizers ?
Date: Tue, 22 Oct 2013 18:19:28 -0700
Message-ID: <52672420.6090109@computer.org> (raw)
In-Reply-To: <CADK3HH+mydhDZr+B3ER61MYBdwfoXT7WYKNnObRJZBFRya4rBg@mail.gmail.com>
References: <9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de>
<CABWW-d2rT-dGEh-hrtemgo2z6dm5H2VUz86y-xmgs3p_6Hv+_w@mail.gmail.com>
<E177372F-3F90-4F1D-9A34-84B3A678A988@pilhuhn.de>
<CABWW-d2EfWuCV7ZDGoWpz1GiFEM_zNX6rq1PHdHNm_HbZ3EM2w@mail.gmail.com>
<B86EB807-F8DF-4F2A-BBC9-6CAB925FCDE9@pilhuhn.de>
<CADK3HH+CaUF3gG-D3fTZn4OeKdP+39=iqgww1Wp7hYBiypKidg@mail.gmail.com>
<CAPPfruy+mPWfg9WmWQGaRVTAQS9kBgF1pi9oJB4ZcgRyZ87few@mail.gmail.com>
<CABWW-d1iMgM9-fs2uJ2Vk5rTQnN29nvUvfhQUg0k=jxao-T_KA@mail.gmail.com>
<CADK3HH+mydhDZr+B3ER61MYBdwfoXT7WYKNnObRJZBFRya4rBg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
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
> <mailto: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
> <mailto: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
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: d.wall@computer.org
Subject: Re: Remove usage of finalizers ?
In-Reply-To: <52672420.6090109@computer.org>
References: <9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de> <CABWW-d2rT-dGEh-hrtemgo2z6dm5H2VUz86y-xmgs3p_6Hv+_w@mail.gmail.com> <E177372F-3F90-4F1D-9A34-84B3A678A988@pilhuhn.de> <CABWW-d2EfWuCV7ZDGoWpz1GiFEM_zNX6rq1PHdHNm_HbZ3EM2w@mail.gmail.com> <B86EB807-F8DF-4F2A-BBC9-6CAB925FCDE9@pilhuhn.de> <CADK3HH+CaUF3gG-D3fTZn4OeKdP+39=iqgww1Wp7hYBiypKidg@mail.gmail.com> <CAPPfruy+mPWfg9WmWQGaRVTAQS9kBgF1pi9oJB4ZcgRyZ87few@mail.gmail.com> <CABWW-d1iMgM9-fs2uJ2Vk5rTQnN29nvUvfhQUg0k=jxao-T_KA@mail.gmail.com> <CADK3HH+mydhDZr+B3ER61MYBdwfoXT7WYKNnObRJZBFRya4rBg@mail.gmail.com> <52672420.6090109@computer.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox