pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Vitaly V. Voronov <wizard_1024@tut.by>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: Peter Geoghegan <pg@bowt.ie>
Subject: Re: BUG #15144: *** glibc detected *** postgres: postgres smsconsole [local] SELECT: double free or corruption (!pre
Date: Tue, 17 Apr 2018 04:48:14 +0100
Message-ID: <87y3hmee19.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <1935021523893352@web12o.yandex.ru>
References: <152296798225.31227.6026116154621550125@wrigleys.postgresql.org>
	<CAH2-Wzk=taczzPfr=MOv0ocq9f9WYvDqOTe11PPsoeWKn8wubQ@mail.gmail.com>
	<3343581523000521@web56o.yandex.ru>
	<CAH2-WznOyqYRgBZMRtq_ZFcrxmiUpygQQxs+Ca-rFrVTgfMfyg@mail.gmail.com>
	<1935021523893352@web12o.yandex.ru>

>>>>> "Vitaly" == Vitaly V Voronov <wizard_1024@tut.by> writes:

 Vitaly> #4  0x0000003d22278c80 in _int_free () from /lib64/libc.so.6
 Vitaly> No symbol table info available.
 Vitaly> #5  0x0000000000808887 in tuplestore_end (state=0x1794898) at tuplestore.c:455
 Vitaly>         i = <value optimized out>

So I may be off base here but...

Line 455 isn't anything to do with tuples; it's the BufFileClose() line.

Furthermore, there's no stack frame between the free() and the
tuplestore_end. From looking at optimized builds, this suggests that
free() has been reached via tail calls, and the only way I see that
happening is when pfree() is being called on a large allocation (one
large enough to be its own chunk), which shouldn't happen for tuples in
this example. (It can happen for the memtuples array itself.)

BufFile is a struct with a big buffer in it, though, so it'll be a large
allocation, hence the pfree() at the end of BufFileClose will end up in
free() via tail calls.

Of course the weak point in this theory is that there seems to be no
reason at all why BufFileClose could possibly get called twice ...
the only other theory would be that something has somehow reset the
memory context _before_ we got here.

-- 
Andrew (irc:RhodiumToad)




view thread (28+ messages)  latest in thread

Message-ID: <87y3hmee19.fsf@news-spur.riddles.org.uk>
Permalink:  ../87y3hmee19.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87y3hmee19.fsf@news-spur.riddles.org.uk

 · 

reply

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: andrew@tao11.riddles.org.uk, wizard_1024@tut.by, tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, andres@anarazel.de, pg@bowt.ie
  Subject: Re: BUG #15144: *** glibc detected *** postgres: postgres smsconsole [local] SELECT: double free or corruption (!pre
  In-Reply-To: <87y3hmee19.fsf@news-spur.riddles.org.uk>
  References: <152296798225.31227.6026116154621550125@wrigleys.postgresql.org> <CAH2-Wzk=taczzPfr=MOv0ocq9f9WYvDqOTe11PPsoeWKn8wubQ@mail.gmail.com> <3343581523000521@web56o.yandex.ru> <CAH2-WznOyqYRgBZMRtq_ZFcrxmiUpygQQxs+Ca-rFrVTgfMfyg@mail.gmail.com> <1935021523893352@web12o.yandex.ru> <87y3hmee19.fsf@news-spur.riddles.org.uk>

* 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