Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YccuJ-00026J-E5 for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Mar 2015 16:51:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YccuI-000473-5f for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Mar 2015 16:51:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YccuG-00045C-P3 for pgsql-bugs@postgresql.org; Mon, 30 Mar 2015 16:51:20 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YccuD-0000AY-Cn for pgsql-bugs@postgresql.org; Mon, 30 Mar 2015 16:51:19 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id CE98C5F7B0; Mon, 30 Mar 2015 12:51:16 -0400 (EDT) Date: Mon, 30 Mar 2015 12:51:16 -0400 From: Stephen Frost To: Vladimir Borodin Cc: Tom Lane , pgsql-bugs@postgresql.org Subject: Re: BUG #12918: Segfault in BackendIdGetTransactionIds Message-ID: <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gVeFDRGtAQ0W7qcm" Content-Disposition: inline In-Reply-To: <3F14158B-5484-43B4-B57A-0A3C87121C4F@simply.name> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-46-generic (x86_64) X-Uptime: 12:49:58 up 10 days, 22:38, 4 users, load average: 0.01, 0.06, 0.07 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --gVeFDRGtAQ0W7qcm Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Vladimir Borodin (root@simply.name) wrote: > > 30 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 2015 =D0=B3., =D0=B2 19:44, Stephen F= rost =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0= ): > > * Tom Lane (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 ba= ckends. > >>> Backtraces of all coredumps look similar: > >>> (gdb) bt > >>> #0 0x000000000066bf9b in BackendIdGetTransactionIds (backendID=3D >>> optimized out>, xid=3D0x7f2a1b714798, xmin=3D0x7f2a1b71479c) at sinva= ladt.c:426 > >>> #1 0x00000000006287f4 in pgstat_read_current_status () at pgstat.c:2= 871 > >>> #2 0x0000000000628879 in pgstat_fetch_stat_numbackends () at pgstat.= c:2342 > >>=20 > >> 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_stat= us > >> saw the backend as active and where we're inspecting its sinval entry. > >=20 > > As an immediate short-term workaround, from what I can tell,=20 > > 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. >=20 > I suppose, pg_stat_replication should not be asked too. We have already d= one 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 --gVeFDRGtAQ0W7qcm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJVGX8EAAoJEO1sijiDR2RVyMwQAIeYiOXmbEH7N8Yf/3ySuk8q GhwvHW6II+ocThtyHcNt+f+elf0qvogT7gsJsbaQq89FgPo+S9h4RK2ZRVoYKBKe DZ85bGaXaNkfVdIEbuhrOBLxH6Ku+pSHriUKbT6/IbnVm4DSyjxjliy5iZiOf1UB O3f6WM/DEkBccOG8cSP7OhnpqyFMeImdMG636cx4EpuWmIloy+4EuNxrCrCgqJzR BW5oThhMNw1ML2U07GLfOhRsVBJYPL7wgd7vvHimxO93ZXUARAzkCd2Mil8AdvvG D2G1eaOoFHqMtfjY9PG45/gbd8AMrxgYoZ5280I0+ENtfsjkZjsQau4cY0Sc+obo 75TQJsiIzbwFSRpb1MsGLa9u6R1YVqGpop/uUdFTfhHI3FzSBlY+2PlNK3Wi+Qft y6nRLT79R1cC/2diPWbdyecAF4Z1t9hpIf6LY6OZOICba8Jh36CJO+U8qGafn9SJ on94PzHE3itMSiFxLXngvH2hpCUKGFpnjc9KkgH3R0gDTpWBKG2ywK5+bSfOyh7P CLUvJLlB0dAKnHNulgWdixZS0lZIbeQ7DDVzSl/ngUa7BprLXfnQjYt9rPjAkKHL xiOgZoL0JkigVujprwmVltInT7rjtg0ieXYztqN+HNeNg0MNn9iBqqSYnfEu2/Ib TmeAvy4SkawKsrcVKKRV =HOfA -----END PGP SIGNATURE----- --gVeFDRGtAQ0W7qcm--