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-04-10 08:20:02
Message-ID: 165253DA-253D-4CBE-A89C-28DEB6CFD0B1@simply.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


> 30 марта 2015 г., в 20:54, Vladimir Borodin <root(at)simply(dot)name> написал(а):
>
>>
>> 30 марта 2015 г., в 20:00, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> написал(а):
>>
>> Vladimir Borodin <root(at)simply(dot)name <mailto: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.

No segfaults for more than a week since I’ve upgraded all hosts. Seems, that the patch is good. Thank you very much.

>
> 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 <https://simply.name/>

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Pavithran Sudarmozhi 2015-04-10 09:52:07
Previous Message Michael Paquier 2015-04-10 05:16:35 Re: BUG #13010: After promote postgres try to send old timeline WALs to archive