From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Vitaly V. Voronov <wizard_1024@tut.by>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #15144: *** glibc detected *** postgres: postgres smsconsole [local] SELECT: double free or corruption (!pre
Date: Mon, 16 Apr 2018 16:56:05 -0400
Message-ID: <29479.1523912165@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH2-Wz=RDFQAqczdFezYCuyEHid4eHe6e5uEu1cVsFg7t4Hsyw@mail.gmail.com>
References: <CAH2-Wz==4+OuyyT41md6u3QgJ89RRPMYzAiMGY9vy8Y+E-Lbdg@mail.gmail.com>
<20180416174817.3krcrdtfkiwkhj4s@alvherre.pgsql>
<CAH2-Wz=RDFQAqczdFezYCuyEHid4eHe6e5uEu1cVsFg7t4Hsyw@mail.gmail.com>
Peter Geoghegan <pg@bowt.ie> writes:
> Offhand, I find it more likely
> that some executor slot that imagines that it owns the tuple frees the
> tuple once, which is followed by a call to tuplestore_end() that frees
> the same tuple a second time (a double-free). As I mentioned, we've
> seen several bugs of that general variety in both tuplestore and
> tuplesort in the past. Some of these have been very subtle.
I see that in 9.6, nodeFunctionScan thinks it should do ExecClearTuple
on the func_slot that it's received from tuplestore_gettupleslot,
which it calls with copy = false, meaning that ExecClearTuple might be
deleting a tuple returned by tuplestore_gettuple. I wonder if this
is the same kind of issue we fixed in 90decdba3, only for tuplestore
rather than tuplesort.
tuplestore_gettuple doesn't return should_free = true unless the
tuplestore spilled to disk, so the sort of issue I'm imagining
would only arise for function results large enough to cause a spill.
BTW, I notice that in this situation, readtup_heap seems to be
palloc'ing in the caller's context, but it counts the memory as
if it were in the tuplestore's context. Somebody's confused there.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, pg@bowt.ie, alvherre@alvh.no-ip.org, andres@anarazel.de, wizard_1024@tut.by
Subject: Re: BUG #15144: *** glibc detected *** postgres: postgres smsconsole [local] SELECT: double free or corruption (!pre
In-Reply-To: <29479.1523912165@sss.pgh.pa.us>
References: <CAH2-Wz==4+OuyyT41md6u3QgJ89RRPMYzAiMGY9vy8Y+E-Lbdg@mail.gmail.com> <20180416174817.3krcrdtfkiwkhj4s@alvherre.pgsql> <CAH2-Wz=RDFQAqczdFezYCuyEHid4eHe6e5uEu1cVsFg7t4Hsyw@mail.gmail.com> <29479.1523912165@sss.pgh.pa.us>
* 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