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=<value
> optimized out>, xid=0x7f47769a5538, xmin=0x7f47769a553c) at sinvaladt.c:426
> 426 xact =
> &ProcGlobal->allPgXact[stateP->proc->pgprocno];
>
> (gdb) bt
> #0 0x000000000066bf9b in BackendIdGetTransactionIds (backendID=<value
> 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 <tgl@sss.pgh.pa.us>
To: Vladimir Borodin <root@simply.name>
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.