pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Vladimir Borodin <root@simply.name>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12918: Segfault in BackendIdGetTransactionIds
Date: Mon, 30 Mar 2015 12:51:16 -0400
Message-ID: <20150330165116.GD3663@tamriel.snowman.net> (raw)
In-Reply-To: <3F14158B-5484-43B4-B57A-0A3C87121C4F@simply.name>
References: <20150330162247.2492.923@wrigleys.postgresql.org>
	<17494.1427733227@sss.pgh.pa.us>
	<20150330164454.GC3663@tamriel.snowman.net>
	<3F14158B-5484-43B4-B57A-0A3C87121C4F@simply.name>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

* Vladimir Borodin (root@simply.name) wrote:
> > 30 марта 2015 г., в 19:44, Stephen Frost <sfrost@snowman.net> написал(а):
> > * Tom Lane (tgl@sss.pgh.pa.us <mailto:tgl@sss.pgh.pa.us>) wrote:
> >> root@simply.name writes:
> >>> After upgrading from 9.3.6 to 9.4.1 (both installed from packages on
> >>> yum.postgresql.org) we have started getting segfaults of different backends.
> >>> Backtraces of all coredumps look similar:
> >>> (gdb) bt
> >>> #0  0x000000000066bf9b in BackendIdGetTransactionIds (backendID=<value
> >>> optimized out>, xid=0x7f2a1b714798, xmin=0x7f2a1b71479c) at sinvaladt.c:426
> >>> #1  0x00000000006287f4 in pgstat_read_current_status () at pgstat.c:2871
> >>> #2  0x0000000000628879 in pgstat_fetch_stat_numbackends () at pgstat.c:2342
> >> 
> >> Hmm ... looks to me like BackendIdGetTransactionIds is simply busted.
> >> It supposes that there are no inactive entries in the sinval array
> >> within the range 0 .. lastBackend.  But there can be, in which case
> >> dereferencing stateP->proc crashes.  The reason it's hard to reproduce
> >> is the relatively narrow window between where pgstat_read_current_status
> >> saw the backend as active and where we're inspecting its sinval entry.
> > 
> > As an immediate short-term workaround, from what I can tell, 
> > disabling calls to pg_stat_activity, and pg_stat_database (views), and
> > pg_stat_get_activity, pg_stat_get_backend_idset, and
> > pg_stat_get_db_numbackends (functions) should prevent triggering this
> > bug.
> 
> I suppose, pg_stat_replication should not be asked too. We have already done that on most critical databases but it is hard to be blind :(

Ah, yes, not sure where I dropped that; it was in my initial list but
didn't make it into the final email.

I would expect a fix to be included in the next point release, hopefully
released in the next couple of months.

	Thanks!

		Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (12+ messages)  latest in thread

Message-ID: <20150330165116.GD3663@tamriel.snowman.net>
Permalink:  ../20150330165116.GD3663@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20150330165116.GD3663@tamriel.snowman.net

 · 

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: sfrost@snowman.net, root@simply.name, tgl@sss.pgh.pa.us
  Subject: Re: BUG #12918: Segfault in BackendIdGetTransactionIds
  In-Reply-To: <20150330165116.GD3663@tamriel.snowman.net>
  References: <20150330162247.2492.923@wrigleys.postgresql.org> <17494.1427733227@sss.pgh.pa.us> <20150330164454.GC3663@tamriel.snowman.net> <3F14158B-5484-43B4-B57A-0A3C87121C4F@simply.name> <20150330165116.GD3663@tamriel.snowman.net>

* 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