Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YszfJ-0007Sh-3b for pgsql-bugs@arkaria.postgresql.org; Thu, 14 May 2015 20:23:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YszfI-0001FX-KX for pgsql-bugs@arkaria.postgresql.org; Thu, 14 May 2015 20:23:32 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YszfH-0001FQ-H1 for pgsql-bugs@postgresql.org; Thu, 14 May 2015 20:23:31 +0000 Received: from c.mail.sonic.net ([64.142.111.80]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1YszfE-0006pL-BU for pgsql-bugs@postgresql.org; Thu, 14 May 2015 20:23:29 +0000 Received: from engels (173-228-38-46.dsl.dynamic.fusionbroadband.com [173.228.38.46]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id t4EKNM0j030172 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NOT); Thu, 14 May 2015 13:23:23 -0700 Date: Thu, 14 May 2015 13:23:24 -0700 From: David Gould To: maxim.boguk@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13286: Core dumped during pg_terminate_backend call. Message-ID: <20150514132324.34b5a4e9@engels> In-Reply-To: <20150514042457.2726.49365@wrigleys.postgresql.org> References: <20150514042457.2726.49365@wrigleys.postgresql.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVYhzM9gB1oOmTn2qVINXoa8gfHk5j7FrIFmmj7JrjFvgE3fJVmmcIhNBbg3mKFLF2/oZ9XyqivFMiUzc7VBcame X-Sonic-ID: C;hMR6EXf65BG2Z/jYVPtzAg== M;QuHHEXf65BG2Z/jYVPtzAg== X-Spam-Flag: No X-Sonic-Spam-Details: 1.0/5.0 by cerberusd X-Pg-Spam-Score: -2.6 (--) 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 On Thu, 14 May 2015 04:24:57 +0000 maxim.boguk@gmail.com wrote: > Bug reference: 13286 > Logged by: Maxim Boguk > Email address: maxim.boguk@gmail.com > PostgreSQL version: 9.4.1 > Operating system: Centos Linux > Description: > > Once per few days database getting core dumped during cron run of the > following query: ... > Program terminated with signal 11, Segmentation fault. > #0 0x000000000066bf9b in BackendIdGetTransactionIds (backendID= optimized out>, xid=0x7f47769a5538, xmin=0x7f47769a553c) at sinvaladt.c:426 > 426 xact = > &ProcGlobal->allPgXact[stateP->proc->pgprocno]; > > (gdb) bt > #0 0x000000000066bf9b in BackendIdGetTransactionIds (backendID= optimized out>, xid=0x7f47769a5538, xmin=0x7f47769a553c) 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 > #3 0x00000000006fb132 in pg_stat_get_activity (fcinfo=0x7fffaccf0ee0) at > pgstatfuncs.c:579 This looks like a duplicate of bug #12918 which is a segfault in BackendIdGetTransactionIds that affects pg_stat_activity and similar things. One of my clients also hit that but it is resolved by Tom Lanes patch pasted below. -dg --- From: Tom Lane To: Vladimir Borodin cc: pgsql-bugs@postgresql.org Subject: Re: [BUGS] BUG #12918: Segfault in BackendIdGetTransactionIds Date: Mon, 30 Mar 2015 13:00:01 -0400 Sender: pgsql-bugs-owner@postgresql.org diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c index 81b85c0..a2fde89 100644 *** a/src/backend/storage/ipc/sinvaladt.c --- b/src/backend/storage/ipc/sinvaladt.c *************** BackendIdGetProc(int backendID) *** 403,411 **** void BackendIdGetTransactionIds(int backendID, TransactionId *xid, TransactionId *xmin) { - ProcState *stateP; SISeg *segP = shmInvalBuffer; - PGXACT *xact; *xid = InvalidTransactionId; *xmin = InvalidTransactionId; --- 403,409 ---- *************** BackendIdGetTransactionIds(int backendID *** 415,425 **** if (backendID > 0 && backendID <= segP->lastBackend) { ! stateP = &segP->procState[backendID - 1]; ! xact = &ProcGlobal->allPgXact[stateP->proc->pgprocno]; ! *xid = xact->xid; ! *xmin = xact->xmin; } LWLockRelease(SInvalWriteLock); --- 413,428 ---- if (backendID > 0 && backendID <= segP->lastBackend) { ! ProcState *stateP = &segP->procState[backendID - 1]; ! PGPROC *proc = stateP->proc; ! if (proc != NULL) ! { ! PGXACT *xact = &ProcGlobal->allPgXact[proc->pgprocno]; ! ! *xid = xact->xid; ! *xmin = xact->xmin; ! } } LWLockRelease(SInvalWriteLock); -- David Gould daveg@sonic.net If simplicity worked, the world would be overrun with insects. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs