pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bo Ørsted Andresen <boa@neogrid.dk>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14180: Segmentation fault on replication slave
Date: Tue, 07 Jun 2016 14:07:32 -0400
Message-ID: <20105.1465322852@sss.pgh.pa.us> (raw)
In-Reply-To: <VI1PR04MB14885FE6EBB1465EF8B88515CB5D0@VI1PR04MB1488.eurprd04.prod.outlook.com>
References: <20160607091618.1385.29368@wrigleys.postgresql.org>
	<20160607172115.7pty2qzptgkw5fxg@alap3.anarazel.de>
	<VI1PR04MB14881F9BDA4E90ABAF67A6FFCB5D0@VI1PR04MB1488.eurprd04.prod.outlook.com>
	<20160607174042.dskfqhcjrr5lufwi@alap3.anarazel.de>
	<VI1PR04MB14885FE6EBB1465EF8B88515CB5D0@VI1PR04MB1488.eurprd04.prod.outlook.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

=?iso-8859-1?Q?Bo_=D8rsted_Andresen?= <boa@neogrid.dk> writes:
>> On 2016-06-07 19:41, Andres Freund wrote:
>> Any chance the running version of postgres is out of date with the installed
>> binaries / debug symbols?

> You mean that I upgraded without restarting postgres before the segfault?

I think the reason for the lack of useful backtrace info is that we've
smashed the stack.  Note that the original report shows i == 3324 which is
much larger than the available length of the local items[] array (408).
So presumably, the passed-in "len" was bogus (much too large).

If you're prepared to build a custom version of Postgres, you could
try adding this to _bt_restore_page():

		/* Need to copy tuple header due to alignment considerations */
		memcpy(&itupdata, from, sizeof(IndexTupleData));
		itemsz = IndexTupleDSize(itupdata);
		itemsz = MAXALIGN(itemsz);

+		if (i >= lengthof(items))
+			elog(PANIC, "too many items on btree page");
+
		items[i] = (Item) from;
		itemsizes[i] = itemsz;
		i++;

		from += itemsz;

and then you should get a core dump before the stack is clobbered.

I wonder whether we shouldn't add such a check to the regular sources...

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (15+ messages)  latest in thread

Message-ID: <20105.1465322852@sss.pgh.pa.us>
Permalink:  ../20105.1465322852@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20105.1465322852@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, boa@neogrid.dk, andres@anarazel.de
  Subject: Re: BUG #14180: Segmentation fault on replication slave
  In-Reply-To: <20105.1465322852@sss.pgh.pa.us>
  References: <20160607091618.1385.29368@wrigleys.postgresql.org> <20160607172115.7pty2qzptgkw5fxg@alap3.anarazel.de> <VI1PR04MB14881F9BDA4E90ABAF67A6FFCB5D0@VI1PR04MB1488.eurprd04.prod.outlook.com> <20160607174042.dskfqhcjrr5lufwi@alap3.anarazel.de> <VI1PR04MB14885FE6EBB1465EF8B88515CB5D0@VI1PR04MB1488.eurprd04.prod.outlook.com> <20105.1465322852@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