Re: BUG #13985: Segmentation fault on PREPARE TRANSACTION - Mailing list pgsql-bugs

From Shulgin, Oleksandr
Subject Re: BUG #13985: Segmentation fault on PREPARE TRANSACTION
Date
Msg-id CACACo5SKaGwErY5NLcf9oSomdDZXo8rgRM-OFGA7oR+G6U+WGA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13985: Segmentation fault on PREPARE TRANSACTION  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thu, Feb 25, 2016 at 3:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de> writes:
> > On Wed, Feb 24, 2016 at 10:52 PM, Andres Freund <andres@anarazel.de>
> wrote:
> > At the very least ISTM that we have to make pgprocno volatile (or use a
> >> memory barrier - but we don't have sufficient support for those in the
> >> older branches), and move the PGPROC/PGXACT lookups after the == -1
> >> check.
>
> > Use of volatile doesn't change the resulting code dramatically for me.
>
> Marking pgprocno volatile is silly.  What *is* missing is this:
>
> -       ProcArrayStruct *arrayP = procArray;
> +       volatile ProcArrayStruct *arrayP = procArray;
>
> which corresponds directly to what the problem is: the storage arrayP
> is pointing at may change asynchronously.
>

Right, this makes a lot more sense.

--
Alex

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #13985: Segmentation fault on PREPARE TRANSACTION
Next
From: Ramesh Rajamanickam
Date:
Subject: Query-Sending mail from PostgresSQL