Re: BUG #12918: Segfault in BackendIdGetTransactionIds - Mailing list pgsql-bugs

From Vladimir Borodin
Subject Re: BUG #12918: Segfault in BackendIdGetTransactionIds
Date
Msg-id 165253DA-253D-4CBE-A89C-28DEB6CFD0B1@simply.name
Whole thread Raw
In response to Re: BUG #12918: Segfault in BackendIdGetTransactionIds  (Vladimir Borodin <root@simply.name>)
List pgsql-bugs
> 30 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 2015 =D0=B3., =D0=B2 20:54, Vladimir =
Borodin <root@simply.name> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0=
):
>=20
>>=20
>> 30 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 2015 =D0=B3., =D0=B2 20:00, Tom =
Lane <tgl@sss.pgh.pa.us <mailto:tgl@sss.pgh.pa.us>> =D0=BD=D0=B0=D0=BF=D0=B8=
=D1=81=D0=B0=D0=BB(=D0=B0):
>>=20
>> Vladimir Borodin <root@simply.name <mailto:root@simply.name>> writes:
>>> I=E2=80=99ve also tried to revert dd1a3bcc where this function =
appeared but couldn=E2=80=99t 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.
>>=20
>> Try this.
>=20
> 38 minutes from a bug report to the patch with a fix! You are =
fantastic. Thanks.
>=20
> It compiles, passes 'make check' and 'make check-world=E2=80=99 (I =
think, you have checked it but just in case...). I=E2=80=99ve 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=E2=80=99ve upgraded all hosts. =
Seems, that the patch is good. Thank you very much.

>=20
> Thanks again.
>=20
>>=20
>>             regards, tom lane
>>=20
>> 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 =3D shmInvalBuffer;
>> -     PGXACT       *xact;
>>=20
>>      *xid =3D InvalidTransactionId;
>>      *xmin =3D InvalidTransactionId;
>> --- 403,409 ----
>> *************** BackendIdGetTransactionIds(int backendID
>> *** 415,425 ****
>>=20
>>      if (backendID > 0 && backendID <=3D segP->lastBackend)
>>      {
>> !         stateP =3D &segP->procState[backendID - 1];
>> !         xact =3D &ProcGlobal->allPgXact[stateP->proc->pgprocno];
>>=20
>> !         *xid =3D xact->xid;
>> !         *xmin =3D xact->xmin;
>>      }
>>=20
>>      LWLockRelease(SInvalWriteLock);
>> --- 413,428 ----
>>=20
>>      if (backendID > 0 && backendID <=3D segP->lastBackend)
>>      {
>> !         ProcState  *stateP =3D &segP->procState[backendID - 1];
>> !         PGPROC       *proc =3D stateP->proc;
>>=20
>> !         if (proc !=3D NULL)
>> !         {
>> !             PGXACT       *xact =3D =
&ProcGlobal->allPgXact[proc->pgprocno];
>> !=20
>> !             *xid =3D xact->xid;
>> !             *xmin =3D xact->xmin;
>> !         }
>>      }
>>=20
>>      LWLockRelease(SInvalWriteLock);
>=20
>=20
> --
> May the force be with you=E2=80=A6
> https://simply.name <https://simply.name/>

--
May the force be with you=E2=80=A6
https://simply.name

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #13010: After promote postgres try to send old timeline WALs to archive
Next
From: Michael Paquier
Date:
Subject: Re: PQexec() hangs on OOM