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

From Vladimir Borodin
Subject Re: BUG #12918: Segfault in BackendIdGetTransactionIds
Date
Msg-id C769F567-FB21-438E-B1EF-03628B088B06@simply.name
Whole thread Raw
In response to Re: BUG #12918: Segfault in BackendIdGetTransactionIds  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses 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:00, Tom Lane =
<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> 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.

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=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.

Thanks again.

>=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);


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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #12918: Segfault in BackendIdGetTransactionIds
Next
From: Bruce Momjian
Date:
Subject: Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..)