Re: Problem with tupdesc in jsonb_to_recordset

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Problem with tupdesc in jsonb_to_recordset
Date: 2018-07-11 09:33:14
Message-ID: CA+q6zcUhS8Cz8AaVinJ6bjCsCbV3quuZDecJCTrQRu-ptTfcVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

> On Wed, 11 Jul 2018 at 08:27, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Tue, Jul 10, 2018 at 10:39:28PM +0200, Dmitry Dolgov wrote:
> > I've found out that currently in some situations jsonb_to_recordset can lead to
> > a crash. Minimal example that I've managed to create looks like this:
>
> It would be better not to send the same email across multiple mailing
> lists.

Ok, sorry - next time I'll avoid this.

> On Wed, Jul 11, 2018 at 03:27:13PM +0900, Michael Paquier wrote:
> > I don't think that your solution is correct. From my read of 37a795a6,
> > the tuple descriptor is moved from the query-lifespan memory context
> > (ecxt_per_query_memory) to a function-level context, which could cause
> > the descriptor to become busted as your test is pointing out. Tom?
>
> Hacking my way out I am finishing with the attached, which fixes the
> problem and passes all regression tests. I am not completely sure that
> this the right approach though, I would need to think a bit more about
> it.

So, you removed FreeTupleDesc call - does it mean, that if io->tupdesc will not
be reset in some other situations it's going to be a memory leak?

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2018-07-11 10:38:46 Re: Problem with tupdesc in jsonb_to_recordset
Previous Message Heikki Linnakangas 2018-07-11 08:40:02 Re: BUG #15274: error LOG: server process (PID 13723) was terminated by signal 11: Segmentation fault

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2018-07-11 09:36:24 partition pruning doesn't work with IS NULL clause in multikey range partition case
Previous Message Heikki Linnakangas 2018-07-11 09:27:33 Negotiating the SCRAM channel binding type