Re: BUG #12918: Segfault in BackendIdGetTransactionIds

From: Vladimir Borodin <root(at)simply(dot)name>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #12918: Segfault in BackendIdGetTransactionIds
Date: 2015-03-30 17:54:10
Message-ID: C769F567-FB21-438E-B1EF-03628B088B06@simply.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


> 30 марта 2015 г., в 20:00, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> написал(а):
>
> Vladimir Borodin <root(at)simply(dot)name> writes:
>> I’ve also tried to revert dd1a3bcc where this function appeared but couldn’t do it :( If you would be able to make a build without this commit (if it is easier than fix it in right way), I could install it on several production hosts to test it.
>
> Try this.

38 minutes from a bug report to the patch with a fix! You are fantastic. Thanks.

It compiles, passes 'make check' and 'make check-world’ (I think, you have checked it but just in case...). I’ve built a package and installed it on one host. If everything would be ok, tomorrow I will install it on several hosts and slowly farther. The problem reproduces on our number of hosts approximately once a week. If the problem disappears I will let you know in a couple of weeks.

Thanks again.

>
> regards, tom lane
>
> 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);

--
May the force be with you…
https://simply.name

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2015-03-31 14:27:18 Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..)
Previous Message Tom Lane 2015-03-30 17:00:01 Re: BUG #12918: Segfault in BackendIdGetTransactionIds