Re: json_populate_record issue - TupleDesc reference leak

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: json_populate_record issue - TupleDesc reference leak
Date: 2015-04-30 12:36:02
Message-ID: CAFj8pRBncGmy-HXx76cYmcnsbYQE4UJ1T4JoiW1QVJS=rG5VEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Still issue is not fixed still

create type pt as (a int, b int);
postgres=# select json_populate_record('(10,20)'::pt, '{}');
WARNING: TupleDesc reference leak: TupleDesc 0x7f413ca325b0 (16560,-1)
still referenced

2015-04-30 14:32 GMT+02:00 Bruce Momjian <bruce(at)momjian(dot)us>:

> On Thu, Feb 26, 2015 at 05:31:44PM -0500, Tom Lane wrote:
> > Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > > This doesn't look quite right. Shouldn't we unconditionally release the
> > > Tupledesc before the returns at lines 2118 and 2127, just as we do at
> > > the bottom of the function at line 2285?
> >
> > I think Pavel's patch is probably OK as-is, because the tupdesc returned
> > by get_call_result_type isn't reference-counted; but I agree the code
> > would look cleaner your way. If the main exit isn't bothering to
> > distinguish this then the early exits should not either.
> >
> > What I'm wondering about, though, is this bit at line 2125:
> >
> > /* same logic as for json */
> > if (!have_record_arg && rec)
> > PG_RETURN_POINTER(rec);
> >
> > If that's supposed to be the same logic as in the other path, then how
> > is it that !have_record_arg has anything to do with whether the JSON
> > object is empty? Either the code is broken, or the comment is.
>
> Where are we on this?
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + Everyone has their own god. +
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-04-30 12:37:08 Re: Reducing tuple overhead
Previous Message Bruce Momjian 2015-04-30 12:32:00 Re: json_populate_record issue - TupleDesc reference leak