Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id D185FB53E85 for ; Fri, 25 May 2012 11:51:37 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SXvrd-000360-0a for pgsql-bugs@postgresql.org; Fri, 25 May 2012 14:51:37 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q4PEpKTi021112; Fri, 25 May 2012 10:51:20 -0400 (EDT) To: Jeff Frost cc: pgsql-bugs@postgresql.org Subject: Re: 9.1.3 backends getting stuck in 'startup' In-reply-to: <3B46C63B-A770-45C5-8889-2796C5E3AB84@pgexperts.com> References: <4F9AC452.3050102@pgexperts.com> <28484.1337887297@sss.pgh.pa.us> <4FBE9CDB.3030009@pgexperts.com> <2196.1337897586@sss.pgh.pa.us> <7A939C5B-ABA4-4CF4-9473-F48989399813@pgexperts.com> <2784.1337898946@sss.pgh.pa.us> <3B46C63B-A770-45C5-8889-2796C5E3AB84@pgexperts.com> Comments: In-reply-to Jeff Frost message dated "Thu, 24 May 2012 15:39:34 -0700" Date: Fri, 25 May 2012 10:51:20 -0400 Message-ID: <21111.1337957480@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/201 X-Sequence-Number: 33172 Jeff Frost writes: > On May 24, 2012, at 3:35 PM, Tom Lane wrote: >> Jeff Frost writes: >>> BTW, when I connected to it this time, I had a really long time before my psql was able to send a query, so it seems to be still broken at least. >> Yeah, I was afraid that re-initdb would be at best a temporary solution. > Oh, sorry, I wasn't clear on that. The currently running system is still happy, but the old data directory got stuck in 'startup' for a while when I connected via psql. Hm. That means there is some contributing factor we haven't identified, but what? >> It would probably be useful to confirm the theory that relcache rebuild >> is what makes it stall. You should be able to manually remove the >> pg_internal.init file in the database's directory; then connect with >> psql, and time how long it takes before the pg_internal.init file >> reappears. > So, you're thinking autovac invalidates the cache and causes it to be rebuilt, then a bunch of new connections get stalled as they all wait for the rebuild? Well, it's worse than that: all the incoming sessions each try to rebuild the cache file themselves. So I suspect there's some "thundering herd" effect on your production system, in addition to the fact that it's just plain not cheap. However, if you're seeing significant stall with just a single incoming connection (the old system isn't getting actively used, right?) then there is possibly yet another effect that we need to identify. As the next step, I'd suggest verifying that the stall is reproducible if you remove pg_internal.init (and that it's not there otherwise), and then strace'ing the single incoming connection to see what it's doing. regards, tom lane