Re: Remove usage of finalizers ?

From: Vitalii Tymchyshyn <vit(at)tym(dot)im>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: PG-JDBC Mailing List <pgsql-jdbc(at)postgresql(dot)org>, Tom Dunstan <pgsql(at)tomd(dot)cc>, "Heiko W(dot) Rupp" <hwr(at)pilhuhn(dot)de>
Subject: Re: Remove usage of finalizers ?
Date: 2013-10-23 01:59:47
Message-ID: CABWW-d1c_Cz1V8N6dbdk89EOz63dvWdtmG0bvVpNZwRycX3Zog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

According to jdbc javadoc Statement.close simply releases resources without
waiting for them to be closed automatically.
And good behaving libs in java look for their external resources allocated.
The application may have problems. Last leak I've seen was something like
this.getClass().getResourceAsStream(...) != null. But this was traceable
because one could find unclosed streams in heap dump.
What is proposed here is server side leak that will be invisible while
analyzing application. I can't afford using such a lib in my projects.
23 жовт. 2013 04:04, користувач "Dave Cramer" <pg(at)fastcrypt(dot)com> написав:

> 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(at)tym(dot)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(at)tomd(dot)cc> написав:
>>
>> On 21 October 2013 23:03, Dave Cramer <pg(at)fastcrypt(dot)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
>>>
>>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Dunstan 2013-10-23 04:07:33 Re: Remove usage of finalizers ?
Previous Message Tom Dunstan 2013-10-23 01:33:36 Re: Remove usage of finalizers ?