pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Frost <jeff@pgexperts.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: 9.1.3 backends getting stuck in 'startup'
Date: Thu, 24 May 2012 15:21:37 -0400
Message-ID: <28484.1337887297@sss.pgh.pa.us> (raw)
In-Reply-To: <4F9AC452.3050102@pgexperts.com>
References: <4F9AC452.3050102@pgexperts.com>

Jeff Frost <jeff@pgexperts.com> writes:
> A few times today, we've seen postgresql 9.1.3 backends on Ubuntu 11.10 x86_64
> get stuck in 'startup' mode.  By that I mean the set_ps_output mode. Postgres
> is installed via Martin Pitt's packages.

I took another look at your original report here, and noticed something
that had escaped me the first time: the backtrace shows that what that
backend is doing is loading critical relcache entries the hard way, that
is, via seqscans on the system catalogs.  This happens when the relcache
cache file (pg_internal.init) is missing or stale.  A backend that has
to go through that will write a new pg_internal.init file when it's
done; but if many sessions are connecting at the same time, they'll each
have to do it until someone succeeds in creating a new cache file.

Another piece of evidence is here:

> #5  0x00007f7dd3d91ca4 in ReadBufferExtended (reln=0x7f7dd3b17540,
> forkNum=MAIN_FORKNUM, blockNum=201362, mode=RBM_NORMAL, strategy=<optimized
> out>) at bufmgr.c:246

It's possible that gdb is lying to us, but it sure looks like this read
request is for block 201362 of pg_attribute (I know it's pg_attribute
from the location of the heap_getnext call).  That's 1.5Gb into the
relation, and who knows if it's anywhere near the end yet.

So in other words, we've got a boatload of backends all seqscanning a
pretty darn large relation, and doing so multiple times.  That's
probably enough to explain why it took a long time to finish
initializing; the locking business is likely a red herring.

How big is pg_attribute normally in this database?  I'm suspicious that
what triggered this is some major bloating of pg_attribute (and maybe
some of the other catalogs too).  Once you had that, relcache cache file
invalidations are a fairly routine occurrence --- I think an autovacuum
on one of the system catalogs would trigger that, for example.

			regards, tom lane



view thread (27+ messages)  latest in thread

Message-ID: <28484.1337887297@sss.pgh.pa.us>
Permalink:  ../28484.1337887297@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28484.1337887297@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, jeff@pgexperts.com
  Subject: Re: 9.1.3 backends getting stuck in 'startup'
  In-Reply-To: <28484.1337887297@sss.pgh.pa.us>
  References: <4F9AC452.3050102@pgexperts.com> <28484.1337887297@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